Skip to content
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

Let SetupAllProperties skip inaccessible methods #499

Merged

Conversation

stakx
Copy link
Contributor

@stakx stakx commented Oct 22, 2017

This fixes #498.

@@ -727,11 +727,12 @@ private static void SetupAllProperties(Mock mock, Stack<Type> mockedTypesStack)
// interface as a getter-and-setter property.
.Where(p =>
p.CanRead && p.CanOverrideGet() &&
p.GetIndexParameters().Length == 0 &&
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition gets moved from 2nd to 3rd position because it's more expensive.

// (a) those that are read-only; and
// (b) those that are writable and whose setter can be overridden.
p.GetIndexParameters().Length == 0 &&
ProxyFactory.IsMethodVisible(p.GetGetMethod(), out _))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the additional missing condition that fixes the bug.

@stakx stakx merged commit 1c710eb into devlooped:develop Oct 22, 2017
@stakx stakx deleted the setupallproperties-inaccessible-methods branch October 22, 2017 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant