tpierrain / NFluent

Smooth your .NET TDD experience with NFluent! NFluent is an ergonomic assertion library which aims to fluent your .NET TDD experience (based on simple Check.That() assertion statements). NFluent aims your tests to be fluent to write (with a super-duper-happy 'dot' auto-completion experience), fluent to read (i.e. as close as possible to plain English expression), but also fluent to troubleshoot, in a less-error-prone way comparing to the classical .NET test frameworks. NFluent is also directly inspired by the awesome Java FEST Fluent assertion/reflection library (http://fest.easytesting.org/)
Apache License 2.0
310 stars 53 forks source link

What is ContainsExactly alternative ignoring order? #282

Closed cico88 closed 5 years ago

cico88 commented 5 years ago

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.

dupdob commented 5 years ago

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

cico88 commented 5 years ago

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

dupdob commented 5 years ago

That should do the trick

cico88 commented 5 years ago

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.

dupdob commented 5 years ago

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