This is related to #3726
Given the following code:
[Test]
public void TupleEqualsMismatch()
{
var a = new Tuple<int, double>(1, 1.0);
var b = new Tuple<int, double>(1, 1.5);
Assert.That(a, Is.EqualTo(b).Within(0.2), $"{a} != {b}");
}
On NUnit 3.12 this produces:
Message:
(1, 1) != (1, 1.5)
Expected: (1, 1.5d) +/- 0.20000000000000001d
But was: (1, 1.0d)
On NUnit 3.13 (and 3.14.0-dev-06990) this throws:
Message:
System.ArgumentException : Both arguments must be numeric
Stack Trace:
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
Tests.TupleEqualsMismatch() line 23
There might be other comparers where Tolerance is used, but the EqualConstraintResult.DisplayDifference cannot handle.
There are also comparers where Tolerance is completely ignored, these also fail, but in that case I would say that .Within should not be used.
This is related to #3726
Given the following code:
On NUnit 3.12 this produces:
On NUnit 3.13 (and 3.14.0-dev-06990) this throws:
There might be other comparers where
Toleranceis used, but theEqualConstraintResult.DisplayDifferencecannot handle.There are also comparers where
Toleranceis completely ignored, these also fail, but in that case I would say that.Withinshould not be used.