It looks like recommended way to compare collections in new NUnit is:

int[] iarray = new int[] { 1, 2, 3 };
string[] sarray = new string[] { "a", "b", "c" };

Assert.That( new string[] { "c", "a", "b" }, Is.EquivalentTo( sarray ) );
Assert.That( new int[] { 1, 2, 2 }, Is.Not.EquivalentTo( iarray ) );

This will make sure that you get:

 Expected: equivalent to < 1.0d, 1.0d, 2.0d, 1.0d, 2.0d, 2.0d >
  But was:  < -999.0d, -999.0d, -999.0d, -999.0d, -999.0d, -999.0d >

instead of:

Assert failed, objects are not equal
  • No labels