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).
@stakx stakx force-pushed the event-accessor-recognition branch from 234d19c to 63750bb Compare June 16, 2017 06:19
@stakx stakx merged commit 4e13e6f into devlooped:develop Jun 16, 2017
@stakx stakx deleted the event-accessor-recognition branch June 16, 2017 06:34
@devlooped devlooped locked and limited conversation to collaborators Sep 8, 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