-
-
Notifications
You must be signed in to change notification settings - Fork 802
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
Callback with specific object type fails when not after a Return #872
Comments
Your callback's parameter types should match the parameter types of the method you're setting up, so some of the errors you're seeing are due to that (i.e. a mistake on your part). However, this case looks strange:
I suspect that the above shouldn't work, either. I'll take a closer look sometime during the next few days. |
I am sure that's not what you intended with this issue, but the solution here is to make post- Like I wrote above, if you have a method with parameter list, say, |
I will update my code my side for more consistency. However for your reference please find the following zipped example of the two setups one passes the tests and one does not. If you required an example of the issue. |
Thanks. I've already added these tests to Moq's test suite which cover the same use cases. But I've quickly run your unit tests against Moq's |
Moq version 4.12.0
Callback for a method with multiple parameters when one is a specific object type throws the following error unless the Callback follows a Returns.
Message: Initialization method Project.Services.Tests.__Initialize threw exception. System.ArgumentException: Invalid callback. Setup on method with parameters (String,Object) cannot invoke callback with parameters (String,SpecficObjectType)..
These setups get the above error:
These setups work:
The text was updated successfully, but these errors were encountered: