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

Call count doesn't get updated properly when method is configured to throw exception #472

Closed
stakx opened this issue Oct 5, 2017 · 0 comments
Labels
Milestone

Comments

@stakx
Copy link
Contributor

stakx commented Oct 5, 2017

In some cases, Moq doesn't update a setup's invocation count correctly.

mock.Setup(f => f.Method()).Throws<SomeException>().AtMostOnce();

If this mock's Method gets called twice, the second call won't throw a MockException (due to the max call count having been exceeded), it'll throw a SomeException.

This can be observed when using the obsolete IOccurrence API (setting up an expected call count at Setup time); Verify isn't affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant