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

Make event accessor recognition logic more correct #376

Merged
merged 1 commit into from Jun 16, 2017

Conversation

stakx
Copy link
Contributor

@stakx stakx commented Jun 15, 2017

Up until now, if Moq encounters a method named add_X or remove_X it will assume that it's found an specialname event accessor method without performing any further checks.

This commits adds some trivial type checks and null reference checks to improve that logic somewhat. I hesitate to make this too perfect since that just might break things for F# or COM (see commit 44070a9).

This partially fixes #82.

@@ -61,12 +61,12 @@ public static bool IsDestructor(this MethodInfo method)
}


public static bool IsEventAttach(this MethodBase method)
public static bool LooksLikeEventAttach(this MethodBase method)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's be honest and call it what it really does.

Up until now, if Moq encounters a method named `add_X` or `remove_X`
it will assume that it's found an specialname event accessor method
without performing any further checks.

This commits adds some trivial type checks and null reference checks
to improve that logic somewhat. I hesitate to make this too perfect
since that just might break things for F# or COM (see commit 44070a9).
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