-
Notifications
You must be signed in to change notification settings - Fork 731
Closed
Description
Description
Take for example
methodInfo.Should().BeDecoratedWith<DummyMethodAttribute>().Which.Filter.Should().BeFalse();Even if the call to BeDecoratedWith succeeds and modifies the AssertionChain to report DummyMethodAttribute as the caller identification via the AndWhichConstraint to Which, the next call to Should().BeFalse() will still report methodInfo instead of DummyMethodAttribute.Filter. CallerStatementBuilder simply stops when it encounters the first .Should call.
Reproduction Steps
See test When_a_method_is_decorated_with_an_attribute_it_should_allow_chaining_assertions_on_it
methodInfo.Should().BeDecoratedWith<DummyMethodAttribute>().Which.Filter.Should().BeFalse();Expected behavior
Expected DummyMethodAttribute.Filter to be False, but found True.
Actual behavior
Expected methodInfo to be False, but found True.
Regression?
No
Known Workarounds
None
Configuration
Fluent Assertions 7.0 with the new AssertionChain
Other information
- Same with
TypeAssertions.BeDecoratedWithandBeDecoratedWithOrInherit
Are you willing to help with a pull-request?
Yes, please assign this issue to me.