-
Notifications
You must be signed in to change notification settings - Fork 731
Extended BeEquivalentTo with support for checking the type of the properties #3066
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
Extended BeEquivalentTo with support for checking the type of the properties #3066
Conversation
Qodana for .NETIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at qodana-support@jetbrains.com
|
39828ec to
d51474e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR extends the BeEquivalentTo API to support strict typing, ensuring that the types of properties are compared exactly between the subject and expectation.
- Updated release notes documentation to include the new WithStrictTyping and WithStrictTypingFor options.
- Added comprehensive tests for type equality, including new test cases in TypeEqualitySpecs.cs.
- Implemented strict typing support across several modules (e.g., ITypingRule, AlwaysBeStrictTypingRule, PredicateBasedTypingRule, and TypeEquivalencyStep) and integrated them into the equivalency options.
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| docs/_pages/releases.md | Release notes updated with new strict typing features. |
| Tests/FluentAssertions.Equivalency.Specs/TypeEqualitySpecs.cs | New tests to validate strict typing behaviors in equivalency assertions. |
| Tests/Benchmarks/UsersOfGetClosedGenericInterfaces.cs | Benchmark config updated to include TypingRules. |
| Tests/Approval.Tests/ApprovedApi/FluentAssertions/*.verified.txt | Approval tests updated for new strict typing API members. |
| Src/FluentAssertions/Equivalency/Steps/TypeEquivalencyStep.cs | New equivalency step implementation for enforcing strict typing. |
| Src/FluentAssertions/Equivalency/Typing/*.cs | New strict typing rule implementations added and exposed in the API. |
| Src/FluentAssertions/Equivalency/SelfReferenceEquivalencyOptions.cs | Integrated strict typing rules into equivalency options for global override. |
Comments suppressed due to low confidence (1)
Src/FluentAssertions/Equivalency/IEquivalencyStep.cs:13
- It appears that the documentation comment is truncated (''). Please update this comment to correctly reflect the intended message.
/// have to be executed. Should return <see cref="EquivalencyResult.ContinueWithNext"/> otherwise. <see langword="tru"/>
d51474e to
e14b254
Compare
Pull Request Test Coverage Report for Build 15982170862Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
e14b254 to
bab34e5
Compare
bab34e5 to
db63a3f
Compare
Src/FluentAssertions/Equivalency/Execution/CollectionMemberOptionsDecorator.cs
Outdated
Show resolved
Hide resolved
db63a3f to
5ee62a4
Compare
5ee62a4 to
86fb81c
Compare
…to ensure types also match
86fb81c to
58a0949
Compare
By default,
BeEquivalentTowill consider objects equivalent as long as their members match, regardless of whether the types are exactly the same. This means that objects of different types can be considered equivalent if they have the same structure and values.However, sometimes you may want to ensure that not only the values match, but also the types are exactly the same. For such scenarios, you can use the strict typing options
WithStrictTypingandWithStrictTypingFor.Closes #798