tpierrain/NFluent

What is ContainsExactly alternative ignoring order?

Closed this issue · 5 comments

How to compare exactly two lists and ignore order, please? The only way I found is to combine Contains and IsOnlyMadeOf, but I don't like it. Thank you for your help.

I think you are looking for IsEquivalentTo.
Please revert if that does not fit your needs.

Great, that helped, but how do I use it with "Extracting",
Check.That(list.Extracting("Property")).IsEquivalentTo ?

That should do the trick

I think I got it, Cast was necessary. Otherwise it complains about: 'ICheck' does not contain a definition for 'IsEquivalentTo'...

Check.That(list.Extracting("Property").Cast<int>()).IsEquivalentTo

Could you confirm that this is correct usage, please? Thank you again.

Thanks for pointing this out. A cast is indeed needed.
I'll create an issue to get rid of this.