Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend == operator in expressions to use NUnit's Assert.AreEqual semantics for collections #7

Open
michael-sterling opened this issue Jan 5, 2021 · 1 comment

Comments

@michael-sterling
Copy link
Contributor

https://docs.nunit.org/articles/nunit/writing-tests/assertions/classic-assertions/Assert.AreEqual.html

NUnit is able to compare single-dimensioned arrays, multi-dimensioned arrays, nested arrays (arrays of arrays) and collections. Two arrays or collections are considered equal if they have the same dimensions and if each pair of corresponding elements is equal.

@michael-sterling michael-sterling self-assigned this May 11, 2021
@michael-sterling
Copy link
Contributor Author

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.

@michael-sterling michael-sterling removed their assignment May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant