• Stars
    star
    222
  • Rank 178,312 (Top 4 %)
  • Language
    C#
  • License
    MIT License
  • Created over 11 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An extensible deep comparison for .NET

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 = object1.IsDeepEqual(object2);

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.

object1.ShouldDeepEqual(object2);

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.

object1.WithDeepEqual(object2)
       .SkipDefault<MyEntity>()
       .IgnoreSourceProperty(x => x.Id)
       .Assert()