I have several Asserts in the following style comparing DateTimes to be equal within small amount of time. This worked well in NUnit 3.12.
Assert.That(DateTime.UtcNow - TimeSpan.FromSeconds(5), Is.EqualTo(DateTime.UtcNow).Within(1).Seconds);
Message:
Expected: 2021-01-15 11:44:01.8274509 +/- 00:00:01
But was: 2021-01-15 11:43:56.8274456
Updating to 3.13 is OK when the test passes, but if the test breaks (for whatever reason), I get the following message.
Message:
System.ArgumentException : Both arguments must be numeric
Obviously, NUnit struggles to create the actual message.
Stacktrace:
Numerics.Difference(Object expected, Object actual, Boolean isAbsolute) line 447
Numerics.Difference(Object expected, Object actual, ToleranceMode toleranceMode) line 436
TextMessageWriter.WriteDifferenceLine(Object expected, Object actual, Tolerance tolerance) line 330
TextMessageWriter.DisplayDifferences(Object expected, Object actual, Tolerance tolerance) line 181
EqualConstraintResult.DisplayDifferences(MessageWriter writer, Object expected, Object actual, Int32 depth) line 96
EqualConstraintResult.WriteMessageTo(MessageWriter writer) line 82
Assert.ReportFailure(ConstraintResult result, String message, Object[] args) line 381
Assert.That[TActual](TActual actual, IResolveConstraint expression, String message, Object[] args) line 229
Assert.That[TActual](TActual actual, IResolveConstraint expression) line 210
I have several
Assertsin the following style comparingDateTimes to be equal within small amount of time. This worked well in NUnit 3.12.Assert.That(DateTime.UtcNow - TimeSpan.FromSeconds(5), Is.EqualTo(DateTime.UtcNow).Within(1).Seconds);Updating to 3.13 is OK when the test passes, but if the test breaks (for whatever reason), I get the following message.
Obviously, NUnit struggles to create the actual message.
Stacktrace: