Skip to content

Extends ApprovalTests to allow simple approval of complex models.

License

Notifications You must be signed in to change notification settings

HEskandari/ObjectApproval

 
 

Repository files navigation

Icon

Extends ApprovalTests to allow simple approval of complex models.

This project is supported by the community via Patreon sponsorship. If you are using this project to deliver business value or build commercial software it is expected that you will provide support via Patreon.

The nuget package NuGet Status

https://nuget.org/packages/ObjectApproval/

PM> Install-Package ObjectApproval

Usage

Assuming you have previously verified and approved using this.

var person = new Person
    {
        GivenNames = "John",
        FamilyName = "Smith",
        Spouse = "Jill",
        Address = new Address
            {
                Street = "1 Puddle Lane",
                Country = "USA"
            }
    };

ObjectApprover.VerifyWithJson(person);

Then you attempt to verify this

var person = new Person
    {
        GivenNames = "John",
        FamilyName = "Smith",
        Spouse = "Jill",
        Address = new Address
            {
                Street = "1 Puddle Lane",
                Suburb = "Gotham",				
                Country = "USA"
            }
    };

ObjectApprover.VerifyWithJson(person);

The serialized json version of these will then be compared and you will be displayed the differences in the diff tool you have asked ApprovalTests to use. For example

SampleDiff

Icon

Helmet designed by Leonidas Ikonomou from The Noun Project

About

Extends ApprovalTests to allow simple approval of complex models.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%