-
-
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
Objects of anonymous types are not matched #552
Comments
When Moq looks for a setup matching the invocation, the invoked method's signature is compared with that of the set up method's (see this method). Return types must match exactly (see this line of code). So even though anonymous types are assignment-compatible with
Making this scenario work by relaxing Moq's method matching logic would be wrong. #343 is likely to be the solution for this problem, if one exists at all. |
Repro 1:
Quoting from the Stack Overflow question, "Moq a function with anonymous type" (see there for details):
Repro 2:
Quoting from another Stack Overflow question, "Setup method with signature
IList<T> Get<T>(Guid id, Expression<Func<EntityName, T>> selector)
" (see there for details):The text was updated successfully, but these errors were encountered: