8000 Let `SetupAllProperties` skip inaccessible methods by stakx · Pull Request #499 · devlooped/moq · GitHub
[go: up one dir, main page]

Skip to content

Let SetupAllProperties skip inaccessible methods - #499

Merged
stakx merged 3 commits into
devlooped:developfrom
stakx:setupallproperties-inaccessible-methods
Oct 22, 2017
Merged

stakx merged 3 commits into
devlooped:developfrom
stakx:setupallproperties-inaccessible-methods

Conversation

@stakx
@stakx stakx commented Oct 22, 2017
Copy link
Copy Markdown
Contributor

This fixes #498.

Comment thread Source/Mock.cs
// interface as a getter-and-setter property.
.Where(p =>
p.CanRead && p.CanOverrideGet() &&
p.GetIndexParameters().Length == 0 &&
Copy link
Copy Markdown
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.

Comment thread Source/Mock.cs
// (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
Copy Markdown
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
@devlooped devlooped locked and limited conversation to collaborators Sep 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0