I’ve found the following odd behavioural difference in Assert.AreEqual between NUnit and Microsoft.VisualStudio.TestTools.UnitTesting.
In NUnit you can specify the following test that will pass:
[TestMethod]
public void IntegerLongComparison()
{
Assert.AreEqual(1, 1L);
Assert.AreEqual(1L, 1);
}
But when you try to do the same with Microsoft’s Unit testing framework it fails.
So this got me thinking. When comparing value types, do you fail the assertion when the types differ?
One part of me says, No! When you think about it, an integer value of 3 is the same as a double value of 3.
3 are 3, isn’t it…?
Well, yes and no. I’m kind of torn between the two arguments. Not sure which way to go on this problem…
What do you feel is the right behavior?
tags: mstest, framework, testing
Currently listening to: ersion) – Winamp *** 1. 2 Brothers on the 4th Floor – Heaven is Here (Radio Version)





