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 Idioms page to include new support for IEqualityComparer<T> #36

Merged
merged 3 commits into from Sep 16, 2020

Conversation

Kralizek
Copy link
Contributor

This PR adds a paragraph to the Idioms page that shows how to use the new EqualityComparerAssertion introduced in AutoFixture 4.14.0.

It also adds a link to the package EqualityTests by baks.

Fixes #35

@@ -187,7 +187,7 @@ Specifically, these assertions are available:
* `EqualsSuccessiveAssertion` verifies that `Object.Equals` is implemented so that calling `x.Equals(y)` several times returns always the same value,
* `GetHashCodeSuccessiveAssertion` verifies that `Object.GetHashCode` is implemented so that calling `x.GetHashCode()` several times returns always the same value.

As of today, developers are left to write unit tests that prove that the symmetric and transitive properties are respected.
As of today, developers are left to write unit tests that prove that the symmetric and transitive properties are respected. [This package](https://www.nuget.org/packages/EqualityTests/) contains the missing tests. Since it's based on AutoFixture 3.36, it might not work with newer versions but developers can take inspiration from [its source code](https://github.com/baks/EqualityTests).
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm afraid that the phrase

contains the missing tests

is not really clear. In what aspect are the tests missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Earlier I have specified the properties must be enforced for a good equality check. AutoFixture does not include idiomatic assertions for all of them. The package I linked adds the missing ones.

@@ -187,7 +187,7 @@ Specifically, these assertions are available:
* `EqualsSuccessiveAssertion` verifies that `Object.Equals` is implemented so that calling `x.Equals(y)` several times returns always the same value,
* `GetHashCodeSuccessiveAssertion` verifies that `Object.GetHashCode` is implemented so that calling `x.GetHashCode()` several times returns always the same value.

As of today, developers are left to write unit tests that prove that the symmetric and transitive properties are respected.
As of today, developers are left to write unit tests that prove that the symmetric and transitive properties are respected but they can be found in [this package](https://www.nuget.org/packages/EqualityTests/). Since this package is based on AutoFixture 3.36, it might not work with newer versions but developers can take inspiration from [its source code](https://github.com/baks/EqualityTests).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it clearer now? @agnerh

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, much better thanks

@Kralizek Kralizek merged commit fbf1520 into keghub:master Sep 16, 2020
@Kralizek Kralizek deleted the idioms-equality-comparer branch September 16, 2020 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Extend Idioms page to include new support for IEqualityComparer<T>
2 participants