Install the NuGet package: SimpleObjectCompareDotNet
Install using the Package Manager in your IDE or using the command line:
dotnet add package SimpleObjectCompareDotNet
[Fact]
public void Should_handle_simple_equal()
{
var result1 = new Simple { Test = "1" };
var result2 = new Simple { Test = "2" };
var result = ObjectComparer.ComparePublicMembers(result1, result2);
result.Should().BeEquivalentTo(new CompareResult(false, nameof(Simple.Test), result1.Test, result2.Test));
}
[Fact]
public void Should_handle_simple_object()
{
var instance = new Simple { Test = "1" };
var result = ObjectMembersCollector.Collect(instance);
result.Should().BeEquivalentTo(new CollectedPropertyValue(typeof(Simple), typeof(string), "Test", "1"));
}