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

[Feature]: SetEquals, unordered equal for collections #2650

Open
philipborg opened this issue May 20, 2024 · 1 comment
Open

[Feature]: SetEquals, unordered equal for collections #2650

philipborg opened this issue May 20, 2024 · 1 comment
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation feature

Comments

@philipborg
Copy link

Background and motivation

We are working a lot with sets, like ImmutableHashSet, and often want to assert the equivalent of SetEquals between two sets. There is no offered API for this that I am aware of. I assume that the desired API in question wouldn't be concerned with sets specifically but just unordered equal for GenericCollectionAssertions, which would be functionally enough for the concerned use case.

Alternative Concerns

  • The Equal methods is explicitly ordered so it's not a replacement.
  • BeEquivalentTo does Equivalent comparison rather than equal, which is often not desired.
  • Calling .SetEquals(expectation).Should().BeTrue() has the issue of giving poor failure messages. If the assertion fails you want to see the difference between them.
  • Equals is not implemented on almost any set implementation.

Are you willing help with a pull-request?

Yes, please assign this issue to me.

@dennisdoomen
Copy link
Member

What kind of API do you suggest?

@jnyrup jnyrup added the api-suggestion Early API idea and discussion, it is NOT ready for implementation label Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation feature
Projects
None yet
Development

No branches or pull requests

3 participants