NUnit Activate list of objects in order

How to set a collection of elements in a specific order? I just want to make sure all the items are in the list.

I heard about CollectionAssert , but I don't see any method that would do what I want.

My object is as follows:

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

Assert - I need something like this:

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

mesh.GetPolygonVertices(int) returns a List<Vector2> and aListOfVertices contains all returned but not guaranteed execution.

+4
source share
1 answer

AreEqual overloads succeed if two collections contain the same objects in the same order. AreEquivalent checks to see if collections contain the same objects, regardless of order.

http://www.nunit.org/index.php?p=collectionAssert&r=2.4

+3
source

Source: https://habr.com/ru/post/1333361/


All Articles