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 AreEqual
overloads succeed if two collections contain the same objects in the same order. AreEquivalent
tests whether collections contain the same objects regardless of their order.
http://www.nunit.org/index.php?p=collectionAssert&r=2.4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With