-
-
Notifications
You must be signed in to change notification settings - Fork 801
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
[Bug?] MockException: invocation failed with mock behavior Strict. All invocations on the mock must have a corresponding setup. #1088
Comments
Moreover, whenever I make it
Moq is happy, and everything works. The only problem is that in reality class is defined in F#, and F# does not support sealed methods. |
Disclaimer: The following info is valid for Moq 4.x (which lives at https://github.com/moq/moq4), it may not be accurate for Moq 5.x (this repository). This is expected behavior. Strict mode means that you must provide a setup for all methods you are calling. The methods' accessibility ( So (a) use either a loose mock together with |
Thanks, now it is clear. What are the changes for Moq 5.x? |
Still not decided on how protected setups would work on v5. You can follow https://github.com/moq/moq/issues/51. Thanks |
I am going to close this issue since it is now in this repo, and an answer for Moq v4 has already been given above. |
Steps to Reproduce
For this code and Strict mode I get :
For Loose mode result is
null
, and not an instance ofHttpResponseMessage
.But should it be like that if I defined behaviour for
public abstract
method?!Expected Behavior
I expect that protected overridden method works as it is.
The text was updated successfully, but these errors were encountered: