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.
https://nuget.org/packages/ObjectApproval/
PM> Install-Package ObjectApproval
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
Helmet designed by Leonidas Ikonomou from The Noun Project