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

Fix misreported setup Times in Verify messages #420

Merged
merged 1 commit into from
Jul 13, 2017

Conversation

stakx
Copy link
Contributor

@stakx stakx commented Jul 13, 2017

This is a fix for #211.

When mock.Verify fails, it lists the mock's setups in the exception message. However, it reports actual invocation counts as the number of expected calls set up, which is misleading at best and incorrect at worst.

Moq currently allows only two kinds of expected call count setups (both of which have been obsoleted): .AtMostOnce() and .AtMost(n). The current logic for formatting a setup is moved to MethodCall (the class representing a setup) where it rightly belongs, and where the expected call count limit is accessible.

This change will also make it easier to introduce the ability to specify any Times on a setup, if that's what gets decided in #373.

When `mock.Verify` fails, it lists the mock's setups in the exception
message. However, it reports actual invocation counts as the number
of expected calls set up, which is incorrect.

Moq currently allows only one kind of expected call count setup (both
of which have been obsoleted): `.AtMostOnce()` and `.AtMost(n)`. The
current logic for formatting a setup is moved to `MethodCall` where it
rightly belongs and where the expected call count limit is accessible.
@stakx stakx force-pushed the verify-misreports-setup-times branch from 9cc1f78 to 18416fd Compare July 13, 2017 15:14
@stakx stakx merged commit e6766a8 into devlooped:develop Jul 13, 2017
@stakx stakx deleted the verify-misreports-setup-times branch July 13, 2017 15:21
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