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

Move matcher selection logic into MatcherFactory #661

Merged
merged 4 commits into from
Aug 24, 2018

Conversation

stakx
Copy link
Contributor

@stakx stakx commented Aug 24, 2018

Logic for creating argument matchers from argument expressions has so far been spread over MatcherFactory and one MethodCall ctor. This refactoring places all of it where it belongs: into MatcherFactory.

This comes at the small additional cost of iterating over arguments a second time to identify out parameters and gather their values, but the added code clarity and clearer responsibilities seem worth it.

After this code move, all matcher selection / creation logic will be
located in `MatcherFactory` only instead of being spread over `Method-
Call`, too.
The logic that creates a matcher for a `params` array parameter would
be better at home in the new `CreateMatcher` overload we created in
the previous refactoring step. Moving it there allows us to get rid of
that `isParams` parameter (i.e. to no longer have a special case) in
the `CreateMatcher` method.
Move the argument matcher selection and out value gathering out of the
ctor into dedicated methods to make the code more legible.

Also rearrange assignments in both ctors to make it easier to see how
they are different from one another.
@stakx stakx added this to the 4.9.1 milestone Aug 24, 2018
@stakx stakx merged commit 1f85444 into devlooped:master Aug 24, 2018
@stakx stakx deleted the matcherfactory branch August 24, 2018 21: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