Open michael-sterling opened 3 years ago
OK, this is turning out to be a lot less trivial than I anticipated. Gonna punt on this for now, though I still very much want it.
NUnit code which handles this: https://github.com/nunit/nunit/blob/master/src/NUnitFramework/framework/Constraints/EqualConstraint.cs
In addition to the definition of equality, I would hope to be able to take advantage of NUnit's "here's how they are different" analysis. Perhaps each equality failure gets some context describing why it failed?
I think the V1 of this feature at least wants to:
(1) Take advantage of the EqualConstraint directly rather than re-implementing it, and
(2) modify the GetDebugExpresssion
logic in the DebugValueExpressionVisitor
to some sort of "replacement expression" or "display expression" notion, rewriting the expression tree to use the new defintion of equality when compiled but output the old operator when displayed.
https://docs.nunit.org/articles/nunit/writing-tests/assertions/classic-assertions/Assert.AreEqual.html