No Free Time

Because my therapist says I need to let things out

Archive for the ‘testing’ Category

MSTest still doesn’t assert array equality properly

Posted by andrewmyhre on April 5, 2008

I ran into this issue today where asserting equality on two arrays always fails, even if the arrays really are equal:

Assert.Equals(new string[] {“value”}, new string[] {“value”}); // always fails

Evidently for arrays the Assert.Equals() method tests object identity, rather object equality, which is what you would expect. There is an Assert.AreSame() method which should test object identity, shouldn’t it?

I found this post from 2005 which notes the problem – I can’t believe they haven’t fixed it by now!

Posted in testing | Tagged: , | 1 Comment »