Found this bug in TimeSpan.Parse
All these tests pass "successfully":
Assert.AreEqual(TimeSpan.Parse("0:00:00.0123456"), TimeSpan.Parse("0:00:00.00123456")); Assert.AreEqual(TimeSpan.Parse("0:00:00.0123456").Ticks, 123456); Assert.AreEqual(TimeSpan.Parse("0:00:00.00123456").Ticks, 123456);
and these
Assert.AreEqual(TimeSpan.Parse("0:00:00.00000098").Ticks, 98); // (no exception thrown) Assert.ThrowsException<OverflowException>(() => TimeSpan.Parse("0:00:00.00000099"));
*edit: dropped a (non-code) letter
0 comments:
Post a Comment