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

Introduce new abstract base class Setup #671

Merged
merged 10 commits into from
Sep 1, 2018
Merged

Conversation

stakx
Copy link
Contributor

@stakx stakx commented Sep 1, 2018

MethodCall represents a setup that is programmable through Moq's Setup API. There are, however, certain kinds of "internal" setups that are not programmable and have much simpler logic.

The intent behind this refactoring is to create a base class for all setups that has a much smaller memory footprint and contains much less logic. Internal, non-programmable setup types can then eventually be derived from that new Setup class.

This PR includes the conversion of PropertyGetterMethodCall, PropertySetterMethodCall, and SequenceMethodCall to the new & lighter-weight Setup base class, including renames to more precise & more consistent names:

  • PropertyGetterMethodCallAutoImplementedPropertyGetterSetup
  • PropertySetterMethodCallAutoImplementedPropertySetterSetup
  • SequenceMethodCallSequenceSetup

This PR does not change MethodCall itself much—that is left to a separate, future refactoring.

`MethodCall` represents a setup that is programmable through Moq's
`Setup` API. There are, however, certain kinds of "internal" setups
that are not programmable and have much simpler logic.

The intent behind this refactoring is to create a base class for all
setups that has a much smaller memory footprint and contains much less
logic. Internal, non-programmable setup types can then eventually be
derived from that new `Setup` class.
It appears as if all setup types would eventually implement this
property in exactly the same way, so we can just as well do it once
in the base class.
This is needed if we want to convert `SequenceMethodCall` away from
`MethodCall`. `SetupWithOutParameterSupport` captures Moq's slightly
counter-intuitive semantics whereby `out` arguments are read at setup
time to find out what they should be set to during an invocation. This
happens for both regular and sequence setups, but isn't built into
the `Setup` base class, so we need a new in-between class for sequence
setups to derive from--this is it.
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