-
-
Notifications
You must be signed in to change notification settings - Fork 798
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
SetupAllProperties() and Mock.Of<T> regression in Moq 4.12.0 #870
Comments
This pattern also fails: var httpContext = Mock.Of<HttpContext>(
context => context.Items == new Dictionary<object, object>());
Assert.NotNull(httpContext.Items); |
Thanks for reporting, @mattzink. I've found the regression. The problem lies here:
|
Ahh, so it's because the property name is "Items" that it thinks it's an indexer. Interesting! |
Yes, Fixed in |
So even with this fix, this issue remains for properties called Item, then? |
@kaan-kaya, good point. I suppose it's time to finally fix the indexer recognition logic for good. |
The following tests pass with Moq 4.11.0 and fail with 4.12.0:
This seems to be very likely caused by #826
Perhaps this new code doesn't handle abstract types correctly?
Environment: Windows x64, .NET Core 2.2.1
The text was updated successfully, but these errors were encountered: