Skip to content

Conversation

@lg2de
Copy link
Contributor

@lg2de lg2de commented Jun 1, 2019

Is this the right way?

Fixes #170

@jnyrup
Copy link
Member

jnyrup 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
Copy link
Contributor Author

lg2de 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
Copy link
Member

jnyrup 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 👍

Copy link
Member

@dennisdoomen dennisdoomen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Can you also please update the docs?

@lg2de
Copy link
Contributor Author

lg2de 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
@lg2de lg2de deleted the NotBeEquivalent branch June 9, 2019 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AreNotEqual

3 participants