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 internal Mock methods non-generic #716

Merged
merged 9 commits into from
Nov 4, 2018

Conversation

stakx
Copy link
Contributor

@stakx stakx commented Nov 4, 2018

This is a continuation of #663. Internal worker methods in the Mock class are made non-generic. The idea here is to restrict the use of generics exclusively to those places where they are useful: in the methods making up the public API. Underneath that layer, Moq should use generics as little as possible in order to avoid needless code duplication, and to make reflection easier.

This means less delegates and closures, and we can drop the `TSetup-
Phrase` generic parameter.
Now that `SetupSetImpl` is no longer generic, the directly calling
methods no longer need to be, either. We can let the non-genericity
"bubble up" into the public API methods where generics surface.

On the side, we get rid of some internal code duplication, as well as
a faulty `Debug.Assert` (which can fail when `SetupSet` is being call-
ed on indexers).
src/Moq/Mock.cs Show resolved Hide resolved
src/Moq/Mock.cs Outdated Show resolved Hide resolved
@stakx stakx merged commit 1d9cf20 into devlooped:master Nov 4, 2018
@stakx stakx deleted the less-generics-in-mock-class branch November 4, 2018 15:41
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