NUnit Assert a list of objects in no order

Posted by Shawn Mclean on Stack Overflow See other posts from Stack Overflow or by Shawn Mclean
Published on 2010-12-25T19:51:35Z Indexed on 2010/12/25 19:54 UTC
Read the original article Hit count: 195

Filed under:

How do I Assert a collection of items in no particular order? I just want to make sure all the items are in the list.

I'm heard of CollectionAssert but I do not see any method that would do what I want.

My object looks like this:

public class Vector2{
    public float X {get; set;}
    public float Y {get; set;}
}

Assert - I want something like this:

CollectionAssert.ContainsAll(mesh.GetPolygonVertices(0), aListOfVertices);

mesh.GetPolygonVertices(int) returns a List<Vector2> and aListOfVertices contains all of what is returned, but not guaranteed that order.

© Stack Overflow or respective owner

Related posts about nunit