{{ message }}
Extended BeEquivalentTo with support for checking the type of the properties#3066
Merged
dennisdoomen merged 1 commit intoJun 30, 2025
Merged
Conversation
39828ec to
d51474e
Compare
There was a problem hiding this comment.
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
jnyrup
requested changes
Jun 29, 2025
db63a3f to
5ee62a4
Compare
jnyrup
reviewed
Jun 30, 2025
5ee62a4 to
86fb81c
Compare
…to ensure types also match
86fb81c to
58a0949
Compare
jnyrup
approved these changes
Jun 30, 2025
This was referenced Jul 22, 2025
This was referenced Jun 20, 2026
Closed
This was referenced Jun 27, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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