vendredi 22 janvier 2016

Values differ at index 1 - for equal nested arrays

Why it's not equal? It's the same with CollectionAssert too.

        var a = new[] { new[] { 1, 2 }, new[] { 3, 4 } };
        var b = new[] { new[] { 1, 2 }, new[] { 3, 4 } };
        // if you comment these two lines the test passes
        a[0] = a[1];
        b[0] = b[1];
        Assert.That(a, Is.EqualTo(b));

Gives:

Expected and actual are both <System.Int32[2][]>
Values differ at index [1]
  Expected and actual are both <System.Int32[2]>

I'm using 2.6.4.14350 nunit and run from ReSharper test runner in VS 32 bit .NET 4.5 project.

Aucun commentaire:

Enregistrer un commentaire