Can anyone help me understand, because the expected value and the actual value have different results in the ToString()
method. When I open the watch for me it is the same value.
Thanks
Code:
[TestMethod]
public void SerializeDecimalWithTwoDecimals()
{
var expected = decimal.Round(1.00M,2);
var actual = decimal.Round(1M,2);
Assert.AreEqual(expected.ToString(), actual.ToString());
}
Microsoft C# documentation:
The scaling factor also preserves any trailing zeros in a Decimal number. Trailing zeros do not affect the value of a Decimal number in arithmetic or comparison operations. However, trailing zeros might be revealed by the ToString method if an appropriate format string is applied link