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

Improve consistency of type names related to method interception #538

Merged
merged 5 commits into from
Dec 2, 2017

Conversation

stakx
Copy link
Contributor

@stakx stakx commented Dec 2, 2017

This is mostly a refactoring of type names surrounding mock method interception. This is mostly to improve naming consistency across the code base, but also to better express the intent of some types.

A few interface types are additionally turned into abstract base classes, allowing us to apply some small-scale optimizations and code cleanup.

First, rename `ICallInterceptor` to `IInterceptor` for consistency.

Second, merge `Interceptor` into `Mock` by letting `Mock` implement
`IInterceptor` directly. This has two advantages:

 1. We no longer need the double composition / wrapping of intercep-
    tors currently found in `CastleProxyFactory`.

 2. Interception can change a mock's state. Having `Mock` perform the
    interception itself means that we get a little closer to the mock
    changing its own state, instead of having it changed by another,
    separate object.
Interception "strategy" suggests that only one of several gets chosen
and executed. In truth, all "strategies" are executed. Each one deals
with a specific aspect of a mock method invocation, so rename the type
to reflect this better.

All source files directly related to method interception are put in a
separate sub-folder `Interception` and renamed for better consistency.
@stakx stakx merged commit 72082ff into devlooped:develop Dec 2, 2017
@stakx stakx deleted the invocation-interception branch December 2, 2017 13:13
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