views:

171

answers:

1

I know how to check that a collection is ordered by some property:

Assert.That(actual, Is.Ordered.By("Foo"));

How can I assert that actual contains the elements (1,2,5,3,4) in this specific order (without writing a custom comparer).

+5  A: 

Use

CollectionAssert.AreEqual(expectedIEnumerable, actualIEnumerable);

This checks that the items are equal and are in the same order.

Mark Dickinson
Thanks, forgot about CollectionAssert
ripper234
Having SO around makes me much more lazy regarding googling.
ripper234
No problem, just shows how useful SO is :)
Mark Dickinson