Skip to main content

EasyTestFile NewtonsoftJson extension making it easy to read files as objects.

Total Downloads
11.6K
11,579
Published
Oct 17, 2024
2y ago

Get Started

dotnet add package EasyTestFile.NewtonsoftJson --version 2.1.10
ProductVersions
.NET
net6.0net8.0
.NET Standard
netstandard2.0netstandard2.1

README

EasyTestFile

EasyTestFile is a library that simplifies the creation and usage of testfiles in unittests. Testfiles (like text, json, xml, binary, jpg, etc. etc.) are named based on the class and method name, are created if not exist, and are embedded as resource making sure the execution of the test is deterministic and do not rely on untracked files etc.

EasyTestFile.Json

This package contains extension methods to deserialize TestFiles using json.

[Fact] // or [Test]
public async Task JsonTestFile()
{
    // load testfile
    var settings = new EasyTestFileSettings();
    settings.UseExtension("json");
    TestFile testFile = EasyTestFile.Load(settings);

    // deserialize testfile using Newtonsoft Json.
    Person person = await testFile.AsObjectUsingNewtonsoft<Person>();

    // do something with person object
    // i.e. sut.Process(person);
}

public class Person
{
    public string Name { get; set; }
}

Downloads by Version

Similar & Alternative Packages

Hand-picked matching NuGet libraries based on tags & ecosystem

Depended On By

Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 4 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.