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
Revisit AssertionScope and how it travels over chained calls #2253
Comments
Do you have some (pseudo) code in mind on how the body of a certain assert method should look like? |
I'm going to do a POC soon to proof this idea to myself ;-) |
Perhaps related to this idea: |
Yeah, that could work indeed. And in case it doesn't work (.NET 6 SDK not installed and using .NET Framework 4.7), we can fall back to the |
The first attempt where |
Although I'm still thinking about the design, I propose the following changes:
AssertionScope
is only used by consumers as they do now and by certain APIs such asBeEquivalentTo
Should
method will create a new object calledAssertion
(but I'm open to a better name) that contains the context of the assertion and a link to the scope. When no ambientAssertionScope
is available, it will be a new one that is created at that point. This is different from v6 where we create a new scope per call toExecute.Assertion
.Should
method will also take an extra parameter annotated with[CallerArgumentExpression]
. If this returns a non-null
value, we can use that instead of using theCallerIdentifier
.Assertion
instance will be explicitly passed to all the assertion classes (likeStringAssertions
).AssertionScope.Current
anymoreAssertionScope
will need to move toAssertion
.ContainSingle
to update theAssertion
instance with extra information to solve Misleading caller identity whenWhich
fails #1502ClearExpectations
AssertionScope
as a way to group related assertions and its responsibilities as the internal assertion APIThe text was updated successfully, but these errors were encountered: