-
Notifications
You must be signed in to change notification settings - Fork 731
Closed
Milestone
Description
Before you file a bug, have you:
- Tried upgrading to newest version of Fluent Assertions, to see if your issue has already been resolved and released?
- Checked existing open and closed issues, to see if the issue has already been reported?
- Tried reproducing your problem in a new isolated project?
- Read the documentation?
- Considered if this is a general question and not a bug?. For general questions please use StackOverflow.
Description
Is there a good reason why ForConstraint is not available in an IAssertionScope, but only in the AssertionScope implementation?
Reason for this change is, that you can not chain an ForConstraint after a Then, resulting in quite longish sets of Execute.Assertion...
Complete minimal example reproducing the issue
Complete means the code snippet can be copied into a unit test method in a fresh C# project and run.
Minimal means it is stripped from code not related to reproducing the issue.
E.g.
Execute.Assertion
.BecauseOf(because, becauseArgs)
.WithExpectation($"Some expectation {0}}{{reason}}, ", parameter)
.ForCondition(somethingShouldBeTrue)
.FailWith("but cool error.")
.Then
.ForConstraint(occurrenceConstraint, actualCount) // this line here
.FailWith($"Other cool error {{0}}{{reason}}, but found {{1}}.",
coolParameter, bla);Expected behavior:
Chaining a ForConstraint should also work after Then
Actual behavior:
Does not :)
Versions
- Which version of Fluent Assertions are you using? 6.6.0
Metadata
Metadata
Assignees
Type
Projects
Status
✅ Done