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

Implement NotBeEquivalent for objects (fixes #170) #1071

Merged
merged 2 commits into from Jun 4, 2019

Conversation

Projects
None yet
3 participants
@lg2de
Copy link
Contributor

commented Jun 1, 2019

Is this the right way?

Fixes #170

@jnyrup

This comment has been minimized.

Copy link
Collaborator

commented Jun 2, 2019

The implementation looks good to me, but I think we may need to be careful here.

BeEquivalentTo is heavily overloaded with 21 overloads whereas NotBeEquivalentTo has 7 overloads.
So adding overloads of NotBeEquivalentTo dripwise could change the resolved overload between releases.
Not saying that we shouldn't add these overloads, but I think it would be great if we could add them all in one release.

"AA".Should().BeEquivalentTo("BB"); // StringAssertions
"AA".Should().NotBeEquivalentTo("BB"); // does not exists

new object().Should().BeEquivalentTo(new object()); // Object Assertions
new object().Should().NotBeEquivalentTo(new object());  // does not exists, but would exist with this PR

new[] { "AA" }.Should().BeEquivalentTo(new[] { "BB" }); // StringCollectionAssertions
new[] { "AA" }.Should().NotBeEquivalentTo(new[] { "BB" });  // CollectionAssertions

new[] { 1 }.Should().BeEquivalentTo(new[] { 2 }); // GenericCollectionAssertions
new[] { 1 }.Should().NotBeEquivalentTo(new[] { 2 }); // CollectionAssertions

new Dictionary<int, int>().Should().BeEquivalentTo(1); // GenericDictionaryAssertions
new Dictionary<int, int>().Should().NotBeEquivalentTo(1); // does not exists

new ComparableOfInt(1).Should().BeEquivalentTo(1); // ComparableTypeAssertions
new ComparableOfInt(1).Should().NotBeEquivalentTo(1); // does not exists
@lg2de

This comment has been minimized.

Copy link
Contributor Author

commented Jun 2, 2019

Currently there are some overloads for NotEquivalent, some are missing.
With adding this one the Situation is not changed, but #170 is fixed.

@jnyrup

This comment has been minimized.

Copy link
Collaborator

commented Jun 2, 2019

Had a deeper look at the inheritance graphs.
Only StringCollectionAssertions and GenericCollectionAssertions inherits NotBeEquivalentTo from CollectionAssertions, otherwise it looks fine.

So no objections anyway 👍

@jnyrup

jnyrup approved these changes Jun 2, 2019

@dennisdoomen
Copy link
Member

left a comment

Looks good. Can you also please update the docs?

@lg2de

This comment has been minimized.

Copy link
Contributor Author

commented Jun 2, 2019

I added small portion of documentation.
I did not find additional senseful references to BeEquivalentTo. So, I do not know where to have additional documentation for the new overload.

@dennisdoomen dennisdoomen merged commit 3d6ac5a into fluentassertions:master Jun 4, 2019

1 check failed

continuous-integration/appveyor/pr AppVeyor build failed
Details

@lg2de lg2de deleted the lg2de:NotBeEquivalent branch Jun 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.