| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| public class ExcludingByType | ||
| { | ||
| [Fact] | ||
| public void When_excluding_members_by_type_it_should_exclude_exact_type_matches() |
There was a problem hiding this comment.
@copilot don't use terms like "when" and "should", but instead use a current or future tense form for all test name.
Sorry, something went wrong.
There was a problem hiding this comment.
Renamed all test methods to use present/future tense without "when" and "should" (commit edeadd1).
Sorry, something went wrong.
There was a problem hiding this comment.
Also update the objectgraphs.md and releases.md
Sorry, something went wrong.
Test Results 37 files ± 0 37 suites ±0 2m 53s ⏱️ +5s Results for commit 56a159e. ± Comparison against base commit d73f064. This pull request removes 10 and adds 28 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+ExcludingByType ‑ Can_exclude_all_closed_generic_types FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+ExcludingByType ‑ Can_exclude_all_types_deriving_from_an_abstract_type FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+ExcludingByType ‑ Can_exclude_all_types_implementing_a_generic_interface FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+ExcludingByType ‑ Can_exclude_exact_type_using_a_type_instance FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+ExcludingByType ‑ Can_exclude_exact_type_using_a_type_parameter FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+ExcludingByType ‑ Can_exclude_multiple_types FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+ExcludingByType ‑ Can_exclude_value_types FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+ExcludingByType ‑ Excluding_applies_to_all_levels_in_a_nested_structure FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+ExcludingByType ‑ Excluding_applies_to_collections_as_well FluentAssertions.Equivalency.Specs.SelectionRulesSpecs+ExcludingByType ‑ Excluding_by_type_with_nested_generics_works … ♻️ This comment has been updated with latest results. |
Sorry, something went wrong.
Updated both objectgraphs.md and releases.md with documentation for the new Excluding<T>() and Excluding(Type) methods. |
Sorry, something went wrong.
Qodana for .NET5 new problems were found
💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact us at qodana-support@jetbrains.com
|
Sorry, something went wrong.
…by type Co-authored-by: dennisdoomen <572734+dennisdoomen@users.noreply.github.com>
Co-authored-by: dennisdoomen <572734+dennisdoomen@users.noreply.github.com>
…hould" Co-authored-by: dennisdoomen <572734+dennisdoomen@users.noreply.github.com>
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 us at qodana-support@jetbrains.com
|
Sorry, something went wrong.
Pull Request Test Coverage Report for Build 20550527439Details
💛 - Coveralls |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
This PR implements the API proposal from #2390 to add a cleaner, more intuitive way to exclude all members of a certain type from structural equivalency assertions, with full support for inheritance and generic type hierarchies.
Motivation
Previously, to exclude all members of a specific type (e.g., TimeSpan), you had to write verbose predicate expressions:
For interfaces, the syntax was even more complex:
And for open generic types like Nullable<>, it was quite cumbersome:
Changes
This PR adds two new methods to SelfReferenceEquivalencyOptions<TSelf>:
1. Generic Method: Excluding<TMember>()
2. Type Parameter Method: Excluding(Type type)
Features
Type Matching with Inheritance Support
For non-sealed types, the exclusion includes all derived types:
Sealed Type Matching
For sealed types (like string), only exact matches are excluded:
Interface and Abstract Type Support
For interfaces and abstract types, all implementing/derived types are excluded:
Open Generic Type Matching with Full Inheritance Support
Supports excluding all closed generics and types deriving from them:
This includes:
Multiple Exclusions
Methods can be chained for excluding multiple types:
Works at All Nesting Levels
Exclusions apply throughout the entire object graph, including nested objects and collections.
Implementation Details
Testing
Breaking Changes
None. This is a purely additive change that maintains full backward compatibility.
Fixes #2390
Original promptFixes #3114
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.