Skip to main content
net5.0net6.0.NETStandard2.0.NETStandard2.1

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

Published
Jan 22, 2024
2y ago
Total Downloads
11.6K
11,579

Install

dotnet add package EasyTestFile.NewtonsoftJson --version 2.1.5-alpha
ProductVersions
.NET
net5.0net6.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; }
}

Changes from Previous Version

No structural changes between v2.0.6 and v2.1.5-alpha.

Adoption Assessment

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

This version is marked prerelease. Validate its API and upgrade path before production use.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.