The format that is used to produce the expected and actual components of an assertion failure message does not provide enough precision.
This leads to non-informative failure messages such as:
Assertion failed. Expected values to be equal.
expected: 09/06/2026 13:12:21
actual: 09/06/2026 13:12:21
To reproduce, compile and run the following test:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public sealed class DateTimeTest
{
[TestMethod]
public void DateTime_AreEqual_TicksNotEqual()
{
var d1 = DateTime.Now;
var d2 = DateTime.Now.AddTicks(1);
Assert.AreEqual(d1, d2);
}
}
This "issue" applies to DateTime and DateTimeOffset, but I'm sure it applies to other types as well.
Would you consider using another (type-specific) format, eg. "O" for DateTime?
Alternatively, MSTest could be configured with specific "formatters".
The format that is used to produce the expected and actual components of an assertion failure message does not provide enough precision.
This leads to non-informative failure messages such as:
To reproduce, compile and run the following test:
This "issue" applies to DateTime and DateTimeOffset, but I'm sure it applies to other types as well.
Would you consider using another (type-specific) format, eg. "O" for DateTime?
Alternatively, MSTest could be configured with specific "formatters".