Skip to content

PolarbearDK/NUnit.DeepObjectCompare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

NUnit.DeepObjectCompare

Add deep (per property) object comparison to NUnit.

Usage

Available as a NuGet package: NUnit.DeepObjectCompare

To install NUnit.DeepObjectCompare, run the following command in the Package Manager Console

PM> Install-Package NUnit.DeepObjectCompare

Add using statement

using NUnit.DeepObjectCompare;
or
using Is = NUnit.DeepObjectCompare.Is;

Assert deep equality:

Assert.That(actualObject, Is.DeepEqualTo(expectedObject));

Assert deep inequality:

Assert.That(actualObject, Is.Not.DeepEqualTo(expectedObject));

Assert equality (advanced):

var comparisonConfig = new ComparisonConfig() { MembersToIgnore = new List<string>() {"Bar"} };

Assert.That(actualObject, Is.DeepEqualTo(expectedObject).WithComparisonConfig(comparisonConfig));

Use WithComparisonConfig or WithCompareLogic to configure the specifics of the comparison. See CompareNetObjects which is the excelent comparison engine used by NUnit.DeepObjectCompare

Additional examples

For more examples, check out the unit tests for these projects:

About

Compare deep object graphs with NUnit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published