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 | 300 | 1/16/2024 |
8.0.18 | 105 | 1/16/2024 |
8.0.17 | 105 | 1/16/2024 |
8.0.16 | 105 | 1/16/2024 |
8.0.15 | 100 | 1/16/2024 |
8.0.14 | 109 | 1/16/2024 |
8.0.13 | 111 | 1/16/2024 |
8.0.12 | 109 | 1/16/2024 |
8.0.11 | 102 | 1/16/2024 |
8.0.10 | 113 | 1/16/2024 |
8.0.9 | 105 | 1/16/2024 |
8.0.8 | 112 | 1/16/2024 |
8.0.7 | 96 | 1/16/2024 |
8.0.6 | 109 | 1/15/2024 |
8.0.4 | 113 | 1/15/2024 |
1.0.0 | 120 | 1/15/2024 |
Improve package namespace and folder