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.
The
AreEqualoverloads succeed if two collections contain the same objects in the same order.AreEquivalenttests whether collections contain the same objects regardless of their order.http://www.nunit.org/index.php?p=collectionAssert&r=2.4