Skip to content
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

Update invocation count correctly, even when setup throws exception #473

Merged
merged 3 commits into from
Oct 5, 2017

Conversation

stakx
Copy link
Contributor

@stakx stakx commented Oct 5, 2017

This fixes #472.

which shows that Moq doesn't appear to correctly record a setup's
invocation count when the setup method is configured to throw an
exception.

This appears to happen only when the (obsolete) `IOccurrence` API
is used to set up a max call count in advance, a post-call `Verify`
isn't affected.
When a setup is matched and executed, it will trigger any configured
callback and exceptions *before* it increases its call count. To make
each invocation count, the call count should be incremented before
anything else takes place.
@stakx stakx merged commit 9a814b1 into devlooped:develop Oct 5, 2017
@stakx stakx deleted the callcount branch October 5, 2017 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant