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

Add new mock.Protected().Setup() method overload #751

Merged
merged 3 commits into from
Feb 20, 2019

Conversation

stakx
Copy link
Contributor

@stakx stakx commented Feb 20, 2019

This adds a new method overload for mock.Protected().Setup():

ISetup<TMock> Setup(string voidMethodName, bool exactParameterMatch, params object[] args);

in addition to the existing one:

ISetup<TMock> Setup(string voidMethodName, params object[] args);

This means that with a call such as the following:

mock.Protected().Setup("SomeVoidMethod", true, arg, anotherArg);

true will be interpreted as the exactParameterMatch parameter instead of as the first method argument. This can break existing code, but it can also help new code where the exactParameterMatch is needed to choose the right method to be setup (e.g. fixes #735).

Fails because there is no `.Protected().Setup()` overload for void
methods taking an `exactParameterMatch` parameter, which is not imm-
ediately obvious when looking at the code.
@stakx stakx added this to the 4.11.0 milestone Feb 20, 2019
@stakx stakx force-pushed the new-protected-setup-overload branch 2 times, most recently from e8e4e8b to c19620b Compare February 20, 2019 07:30
@stakx stakx force-pushed the new-protected-setup-overload branch from c19620b to ae280f6 Compare February 20, 2019 07:31
@stakx stakx merged commit b60c0d9 into devlooped:master Feb 20, 2019
@stakx stakx deleted the new-protected-setup-overload branch February 20, 2019 07:39
Shereef added a commit to Shereef/moq4 that referenced this pull request Feb 20, 2019
Shereef added a commit to Shereef/moq4 that referenced this pull request Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Moq.Protected.Setup() Breaks On Abstract Class with Overloaded Abstract Methods
1 participant