Wednesday, April 18, 2012

Testing the Order of Your Collections

I was trying to test that a service call was returning my data in order. I didn’t want to implement an IComparer to pass into CollectionAssert.IsOrdered(). Thanks to some insight from Ahmad on StackOverflow I was able to come up with the following assert:

Assert.That(result, Is.Ordered.By("Name"));

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Follow me on