New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ForConstraint
to IAssertionScope
#1918
Comments
I can't remember at the top of my head why we didn't also include it on |
Ok, so if we add it at v7 take the following also into consideration: for now you have to include To handle this, I have two possible solutions:
Hope this is clear :) Execute.Assertion
.BecauseOf(because, becauseArgs)
.WithExpectation($"Some expectation {0}}{{reason}}, ", parameter)
.WithReportabe("expectedOccurrence")
.ForCondition(somethingShouldBeTrue)
.FailWith("but cool error.")
.Then
.ForConstraint(occurrenceConstraint, actualCount) // this line here
.FailWith($"Other cool error {{0}}{{reason}}, but found {{1}}.",
coolParameter, bla); |
While implementing this I changed my mind about the second
|
This is also related to #2253 |
Before you file a bug, have you:
Description
Is there a good reason why
ForConstraint
is not available in anIAssertionScope
, but only in theAssertionScope
implementation?Reason for this change is, that you can not chain an
ForConstraint
after aThen
, resulting in quite longish sets ofExecute.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.
Expected behavior:
Chaining a
ForConstraint
should also work afterThen
Actual behavior:
Does not :)
Versions
The text was updated successfully, but these errors were encountered: