This repository was archived by the owner on Jun 30, 2023. It is now read-only.
Add new ways of verifying mocks, with syntax and fluent APIs #39
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Just like for Arg, Raise and Setup, there is now a Syntax-based Verify which
allows much more succinct code. With the following using at the top:
You can now perform verifications on a mock as follows:
Verifiable setups can now just add
Once,NeverandExactlydirectly onthe setup too (unlike v4 which only had
Verifiable()which meantAtLeastOnce)A non-syntax version is also provided, which is basically called from the
syntax one:
A mechanism in the SDK for cloning mocks was added, so that they can be
"frozen" and tweaked independently from the original mock (i.e. for verification
purposes).
As part of cleaning up a mock's behaviors for cloning and verification, we took
the chance to split the former
MockTrackingBehavior(which was doing two things)into
MockContextBehavior(the one that sets theMockContextstatic properties)and
MockRecordingBehavior(which does the actual invocation recording). Thisallows getting a cloned mock that does not record calls, for example, for verifying
purposes or diagnostics, say. This could be used to also clone on debugger inspection,
to allow preserving the actual calls instead of having the inspection to modify the
actual calls (which is what happens typically by default in all mocking libraries).