- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 811
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 setting of nested non-overridable properties via Mock.Of
#1061
Fix setting of nested non-overridable properties via Mock.Of
#1061
Conversation
} | ||
try | ||
{ | ||
propertyToSet.SetValue(targetMock.Object, value, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could go one step further here and add support for indexers by passing through the index arguments instead of hard-coding null
as the last argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving this unresolved for now. Supporting indexers for non-overridable properties would only work partly anyway, e.g. you could only use fixed values (no matchers) for the index arguments. Not sure if it's worth doing the work to support this scenario as far as is possible.
Note to self: It may be worth reconsidering whether The logic inside this type should work just as well for non-overridable methods, it's external parties that add the "method must be overridable (and visible to the proxy factory)" requirement. It might therefore be better to extract validation from Each party that currently builds up |
334cb6d
to
bbaed39
Compare
...and hook it up to the part of `Mock.Of` that deals with setting non- overridable properties.
bbaed39
to
5a424b0
Compare
Fixes #1039.