1

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?

YMM
  • 632
  • 1
  • 10
  • 21
  • FWIW, even though you are using NUnit, this isn't precisely related to NUnit. The message is something generated in the way fluent-assertions uses NUnit. – Charlie Feb 26 '19 at 14:57
  • Ok, I'll remove the wrong tag. – YMM Feb 26 '19 at 16:12
  • @Charlie, maybe this can be achieved with NUnit's collection assertions only? – YMM Feb 26 '19 at 20:31
  • I'm uncertain exactly what fluent-assesrtions is doing here with it's equivalency test, so I'm not sure. – Charlie Feb 27 '19 at 18:21

1 Answers1

1

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.

Dennis Doomen
  • 8,368
  • 1
  • 32
  • 44