`I am trying to compare two complex objects and the output from the test generates the same Json but the test fails. How can I tell which properties are causing the failure?
Test Declaration:
am.Should()
.BeEquivalentTo(ms, options =>
{
return options
.WithTracing()
.WithAutoConversion()
//I've set `CompareByValue` for the complex properties.
.ComparingByValue<IEarTag>()
.ComparingByValue<InternationalId>()
.ComparingByValue<StrippedEarTag>()
.ComparingByValue<DamSummaryDTO>()
.ComparingByValue<SireSummaryDTO>();
});
Result Trace
With configuration:
- Use declared types and members
- Compare enums by value
- Compare tuples by their properties
- Compare anonymous types by their properties
- Compare records by their members
- Compare HukNetCore.Common.Animal.IEarTag by value
- Compare HukNetCore.Common.InternationalId by value
- Compare HukNetCore.Common.Animal.StrippedEarTag by value
- Compare HukNetCore.Common.Animal.DamSummaryDTO by value
- Compare HukNetCore.Common.Animal.SireSummaryDTO by value
- Include non-browsable members
- Match member by name (or throw)
- Be strict about the order of items in byte arrays
- Try conversion of all members.
With trace:
am
{
Treating am as a value type because HukNetCore.Common.AnimalDTO overrides Equals.
Equivalency was proven by ValueTypeEquivalencyStep
}