GPreviatti.Util.JsonResourceAttribute 8.0.19

dotnet add package GPreviatti.Util.JsonResourceAttribute --version 8.0.19                
NuGet\Install-Package GPreviatti.Util.JsonResourceAttribute -Version 8.0.19                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GPreviatti.Util.JsonResourceAttribute" Version="8.0.19" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GPreviatti.Util.JsonResourceAttribute --version 8.0.19                
#r "nuget: GPreviatti.Util.JsonResourceAttribute, 8.0.19"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install GPreviatti.Util.JsonResourceAttribute as a Cake Addin
#addin nuget:?package=GPreviatti.Util.JsonResourceAttribute&version=8.0.19

// Install GPreviatti.Util.JsonResourceAttribute as a Cake Tool
#tool nuget:?package=GPreviatti.Util.JsonResourceAttribute&version=8.0.19                

Json Resource Attribute Package

Publish in Nuget.org

Vulnerabilities Bugs Duplicated Lines (%) Code Smells Coverage Technical Debt

This simple package that exposes an attribute to helps testing with json files.

How to use

Install package in test project and add this block in your csproj file in order to copy your json files into the debug folder

<ItemGroup>
	<None Remove="**\*.json" />
	<EmbeddedResource Include="**\*.json" Exclude="bin\**;obj\**" />
</ItemGroup>

You should create a json file and add the node with a name that will be identified by the test in the example the name is majorAge

Decorate your test method with JsonResourceData attribute, add the json file reference and test node name

[Theory(DisplayName = nameof(People_Should_Have_Major_Age))]
[JsonResourceData("json-resource-data-attribute.json", "majorAge")]
public void People_Should_Have_Major_Age(Person[] people, bool expected)
{
    // Arrange, Act
    var result = people.Any(p => p.IsMajorAge().Equals(expected));

    // Assert
    Assert.True(result);
}

Samples

The samples of how to use the json resource attribute are available in test project of package

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.19 313 1/16/2024
8.0.18 107 1/16/2024
8.0.17 107 1/16/2024
8.0.16 107 1/16/2024
8.0.15 102 1/16/2024
8.0.14 111 1/16/2024
8.0.13 113 1/16/2024
8.0.12 111 1/16/2024
8.0.11 106 1/16/2024
8.0.10 117 1/16/2024
8.0.9 109 1/16/2024
8.0.8 114 1/16/2024
8.0.7 98 1/16/2024
8.0.6 111 1/15/2024
8.0.4 115 1/15/2024
1.0.0 122 1/15/2024

Improve package namespace and folder