-
Notifications
You must be signed in to change notification settings - Fork 289
Closed
Labels
Help-WantedThe issue is up-for-grabs, and can be claimed by commentingThe issue is up-for-grabs, and can be claimed by commenting
Description
Description
Significant digits smaller than milliseconds of DateTime values in DynamicData are lost when the value enters the TestMethod.
Steps to reproduce
- MSTest.TestFramework 2.2.5-preview-20210605-01
- MSTest.TestAdapter 2.2.5-preview-20210605-01
- Microsoft.NET.Test.Sdk 16.10.0
- Net Core 3.1
[TestMethod]
[DynamicData(nameof(TestCases), DynamicDataSourceType.Method)]
public void DateTimeTest(DateTime value1, DateTime value2, string _)
{
var actual = value1 == value2;
Assert.AreEqual(false, actual);
}
public static IEnumerable<object[]> TestCases()
{
var now = new DateTime(2021, 06, 14, 12, 13, 14);
yield return new object[] { now, now + TimeSpan.FromTicks(1), "100 ns" };
yield return new object[] { now, now + TimeSpan.FromTicks(10), " 1 us" };
yield return new object[] { now, now + TimeSpan.FromTicks(100), " 10 us" };
yield return new object[] { now, now + TimeSpan.FromTicks(1000), "100 us" };
yield return new object[] { now, now + TimeSpan.FromTicks(10000), " 1 ms" };
yield return new object[] { now, now + TimeSpan.FromTicks(100000), " 10 ms" };
yield return new object[] { now, now + TimeSpan.FromTicks(1000000), "100 ms" };
}
Expected behavior
All 7 test cases should pass
Actual behavior
The first 4 test cases fail, the last 3 pass.
Environment
Windows 2004 build 19041.1052
Metadata
Metadata
Assignees
Labels
Help-WantedThe issue is up-for-grabs, and can be claimed by commentingThe issue is up-for-grabs, and can be claimed by commenting