I want to assert that the contents of two lists of dtos are equivalent. However, I want one property on each item to be ignored in the comparison. From reading the collections & dictionaries subsection of the Fluent Assertions documentation, my understanding is that this line should do what I want:
response.ShouldAllBeEquivalentTo(expected, options => options.Excluding(activity => activity.ActivityDetails.InternalId));
I have written a unit test that should pass, but this statement results in an AssertionException being thrown with the following message:
Expected item[0].ActivityDetails.InternalId to be 0, but found 19372.
Expected item[1].ActivityDetails.InternalId to be 0, but found 19374.
Expected item[2].ActivityDetails.InternalId to be 0, but found 19376.
With configuration:
Select all declared properties
Exclude property ActivityDetails.InternalId
Match property by name (or throw)
Invoke Action when info.RuntimeType.IsSameOrInherits(System.String)
I have probably misunderstood the documentation. Can anybody point out what I'm doing wrong?