| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sorry, something went wrong.
Test Results 37 files ± 0 37 suites ±0 5m 57s ⏱️ -11s Results for commit 580ef79. ± Comparison against base commit efe9635. This pull request removes 10 and adds 18 tests. Note that renamed tests count towards both.FluentAssertions.Specs.Streams.StreamAssertionSpecs+HaveLength ‑ When_a_throwing_stream_should_have_a_length_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object. FluentAssertions.Specs.Streams.StreamAssertionSpecs+HaveLength ‑ When_a_throwing_stream_should_have_a_length_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object. FluentAssertions.Specs.Streams.StreamAssertionSpecs+HavePosition ‑ When_a_throwing_stream_should_have_a_position_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object. FluentAssertions.Specs.Streams.StreamAssertionSpecs+HavePosition ‑ When_a_throwing_stream_should_have_a_position_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object. FluentAssertions.Specs.Streams.StreamAssertionSpecs+NotHaveLength ‑ When_a_throwing_stream_should_not_have_a_length_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object. FluentAssertions.Specs.Streams.StreamAssertionSpecs+NotHaveLength ‑ When_a_throwing_stream_should_not_have_a_length_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object. FluentAssertions.Specs.Streams.StreamAssertionSpecs+NotHavePosition ‑ When_a_throwing_stream_should_not_have_a_position_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object. FluentAssertions.Specs.Streams.StreamAssertionSpecs+NotHavePosition ‑ When_a_throwing_stream_should_not_have_a_position_it_should_fail(exception: System.ObjectDisposedException: Cannot access a disposed object. Object name: 'GetLengthExceptionMessage'.) Object name: 'GetPositionExceptionMessage'.) FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+Excluding ‑ Excluding_a_member_by_path_and_then_forcing_member_comparison_does_not_fail FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+Excluding ‑ Excluding_a_member_by_path_on_a_type_with_value_semantics_fails_with_a_descriptive_error FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+Excluding ‑ Excluding_a_member_by_path_when_forcing_value_semantics_explicitly_fails_with_a_descriptive_error FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+Excluding ‑ Excluding_a_member_by_predicate_on_a_type_with_value_semantics_fails_with_a_descriptive_error FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+Excluding ‑ Excluding_a_member_by_predicate_when_forcing_value_semantics_explicitly_fails_with_a_descriptive_error FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+Excluding ‑ Excluding_a_member_of_a_collection_element_with_value_semantics_via_For_and_Exclude_fails_with_a_descriptive_error FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+Excluding ‑ Excluding_a_nested_member_by_path_on_a_type_with_value_semantics_fails_with_a_descriptive_error FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+Excluding ‑ Including_a_member_by_path_when_forcing_value_semantics_explicitly_fails_with_a_descriptive_error FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+Excluding ‑ Including_members_by_predicate_on_a_type_with_value_semantics_fails_with_a_descriptive_error FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+Including ‑ Including_a_member_by_path_on_a_type_with_value_semantics_fails_with_a_descriptive_error … ♻️ This comment has been updated with latest results. |
Sorry, something went wrong.
Coverage Report for CI Build 24278160846Coverage decreased (-0.04%) to 97.159%Details
Uncovered Changes
Coverage Regressions9 previously-covered lines in 2 files lost coverage.
Coverage Stats
💛 - Coveralls |
Sorry, something went wrong.
There was a problem hiding this comment.
This PR addresses surprising behavior in BeEquivalentTo() where path-based selection rules (Excluding() / Including()) can be silently ignored when a type is auto-compared by value semantics (EqualityStrategy.Equals). It introduces conflict detection to fail fast with a descriptive assertion message.
Changes:
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file| File | Description |
|---|---|
| docs/_pages/releases.md | Adds a release note describing the new fail-fast behavior for conflicting path rules + value semantics. |
| Tests/FluentAssertions.Equivalency.Specs/SelectionRulesSpecs.Including.cs | Adds a test asserting Including() fails with a descriptive message on value-semantic types. |
| Tests/FluentAssertions.Equivalency.Specs/SelectionRulesSpecs.Excluding.cs | Adds tests asserting Excluding() fails (and explicit overrides do/don’t fail). |
| Src/FluentAssertions/Equivalency/Steps/ValueTypeEquivalencyStep.cs | Adds conflict detection and emits a dedicated assertion failure instead of silently ignoring path rules. |
| Src/FluentAssertions/Equivalency/Selection/SelectMemberByPathSelectionRule.cs | Implements overlap detection (SelectsMembersOf) and normalizes current node paths. |
| Src/FluentAssertions/Equivalency/Selection/IncludeMemberByPathSelectionRule.cs | Refactors to expose the rule MemberPath via the base class for conflict detection. |
| Src/FluentAssertions/Equivalency/Selection/ExcludeMemberByPathSelectionRule.cs | Refactors to expose the rule MemberPath via the base class for conflict detection. |
Sorry, something went wrong.
Detect conflicts between Including/Excluding selection rules and value-semantic comparison so Fluent Assertions reports a descriptive error instead of silently ignoring user intent. This now covers both auto-detected Equals-based value semantics and explicit ComparingByValue() configuration. Use a path-aware selection-rule abstraction so collection decorators can forward path conflict checks without special-case unwrapping, and add coverage for path, predicate, nested, collection, and explicit configuration scenarios. Fixes #2571 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| Back | FazBrowse Home | New Git URL |
Summary
Closes #2571
When Excluding() or Including() targets a member of a type that is compared by value, the rule is silently ignored because BeEquivalentTo() never traverses that type’s members. This is surprising and hard to debug.
This PR detects that conflict at comparison time and fails with a descriptive assertion error.
Changes
This PR now reports a descriptive failure when a selection rule targets a type that is being compared by value, including both:
Example message for auto-detected value semantics:
Example message for explicit ComparingByValue():
All user-specified selection rule types are detected:
Design decisions
Tests
Added coverage for: