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

Support for collection.ShouldContainEquivalentOf #367

Closed
infosaurus opened this issue Mar 4, 2016 · 4 comments
Closed

Support for collection.ShouldContainEquivalentOf #367

infosaurus opened this issue Mar 4, 2016 · 4 comments

Comments

@infosaurus
Copy link

As far as I can tell, Should().Contain() uses Equals() to compare objects. It would be nice to be able to combine Should().Contain() and Should().BeEquivalent() and leverage structural equality instead.

We already have ShouldAllBeEquivalentTo(), this could be called ShouldSomeBeEquivalentTo() or ShouldContainEquivalentOf().

Thanks for this awesome library !

@dennisdoomen
Copy link
Member

Maybe by adding a Should().ContainEquivalentOf which internally leverages the structural equivalency API.

@RTodorov
Copy link

Hi guys,

Is there a workaround to achieve the same result with the current version?

Thank you!

@dennisdoomen
Copy link
Member

You can build your own extension that passes each object in the collection to a call to ShouldBeEquivalenTo to compare each object with the one you like to find. At least one of those objects in the collection must match.

@danielmpetrov
Copy link
Contributor

danielmpetrov commented Sep 6, 2019

Issue #584 was a duplicate of this, and was closed in #950. Please close this one too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants