Search code examples
c#tddbddmspec

Comparing two lists with MSpec


Which method should I use to assert that two lists contains the same objects with MSpec?


Solution

  • You could use the ShouldContainOnly(IEnumerable<T>) extension method.

    So if you have 2 lists, listA and listB use:

    listA.ShouldContainOnly(listB)