.N .NET Landscape

DeepEqual

Inactive Testing
github.com/jamesfoster/DeepEqual

An extensible deep comparison for .NET

⚠ No commits for more than 2 years. Consider an actively maintained alternative from the same subcategory.

c-sharpcomparedeep-equaldeep-equalsequalitytesting
GitHub stars
235
Forks
32
Open issues
2
NuGet downloads
19,900,480
latest 5.1.0
License
MIT
Language
C#
Last push
2 years ago
14 Jul 2024
Created
18 May 2013

DeepEqual

DeepEqual is an extensible deep equality comparison library.

Installing

Install via NuGet (https://www.nuget.org/packages/DeepEqual/)

Install-Package DeepEqual

Usage

To test equality simply call the IsDeepEqual extension method.

bool result = left.IsDeepEqual(right);

When used inside a test you might want to call ShouldDeepEqual instead. This method throws an exception with a detailed description of the differences between the 2 objects.

left.ShouldDeepEqual(right);

// or

left.ShouldDeepEqual(right, comparison);

You can pass a custom comparison as the second argument to the ShouldDeepEqual method to override the default behaviour. You can also customize the behaviour inline using the WithDeepEqual extension method.

left.WithDeepEqual(right)
       .SkipDefault<MyEntity>()
       .IgnoreLeftProperty(x => x.Id)
       .Assert()