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
<PackageReference Include="GPreviatti.Util.JsonResourceAttribute" Version="8.0.19" />
paket add GPreviatti.Util.JsonResourceAttribute --version 8.0.19
#r "nuget: GPreviatti.Util.JsonResourceAttribute, 8.0.19"
// 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
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 | Versions 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. |
-
net8.0
- Newtonsoft.Json (>= 13.0.3)
- xunit.extensibility.core (>= 2.6.6)
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 | 306 | 1/16/2024 |
8.0.18 | 106 | 1/16/2024 |
8.0.17 | 106 | 1/16/2024 |
8.0.16 | 106 | 1/16/2024 |
8.0.15 | 101 | 1/16/2024 |
8.0.14 | 110 | 1/16/2024 |
8.0.13 | 112 | 1/16/2024 |
8.0.12 | 110 | 1/16/2024 |
8.0.11 | 103 | 1/16/2024 |
8.0.10 | 116 | 1/16/2024 |
8.0.9 | 106 | 1/16/2024 |
8.0.8 | 113 | 1/16/2024 |
8.0.7 | 97 | 1/16/2024 |
8.0.6 | 110 | 1/15/2024 |
8.0.4 | 114 | 1/15/2024 |
1.0.0 | 121 | 1/15/2024 |
Improve package namespace and folder