When I compare collections of objects using .BeEquivalentTo()
and there is a mismatch between properties in those collections, I get something like this in error output:
Expected item[8].DaysExpiredMessage to be
"In 8 days", but
"In 9 days" differs near "9 d" (index 3).
However, referring to a collection item by index does not help me much in debugging the test.
Is it possible to include some other property of the object, (e.g. objects in my collection have unique "Id" property) in test output, so I can distinctly identify the item when reviewing failures?
No, unfortunately not. It just means that the item at index 8 of the collection you were comparing has a property which value was missing.