When comparing values with assertions, it is customary for the expected (correct) value to be given first, followed by the actual value:
Assert.AreEqual( <expectedValue>, <actualValue> );
While it makes no difference to the true or false nature of equality, it can make a difference to messages when tests fail with some testing frameworks (for example, "got 2 but expected 3" has a very different meaning to "got 3 but expected 2"). Hence, the following assertion would output a message that would be confusing, since 2 was our expected result:
public void TestTwoEqualsThreeShouldFail() {
// Arrange
int expectedResult = 2;
// Act
int result = 1 + 2; // 3 !!!
// Assert
Assert.AreEqual(result, expectedResult);
}
The following screenshot illustrates how we will get a misleading message when the arguments are the wrong way around in our assertion method...