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

Replace Mock.InnerMocks with InnerMockSetup #760

Merged
merged 10 commits into from
Feb 27, 2019
Merged

Conversation

stakx
Copy link
Contributor

@stakx stakx commented Feb 26, 2019

Mock.InnerMocks is the mechanism that mocks use to keep track of subordinate ("inner") mocks for recursive verification. This data structure causes quite a few problems:

  1. Having both setups and the InnerMocks dictionary for mock members is difficult to understand, especially as the two structures are not necessarily kept in perfect sync.

  2. One example of this is when a setup for some mock member has been overridden, but there is still an InnerMocks entry for that same member. This typically leads to "unreachable" inner mocks being included in recursive verification when they should no longer be included.

  3. InnerMocks is a simple dictionary keyed by method. Unlike setups, it does not store argument information and is therefore much less precise. There can only be one registered inner mock per method.

We can keep track of inner mocks as a special type of setup to solve all of these problems.

This PR takes care of (1) and creates the basis for (2) and (3).

@stakx stakx merged commit b2eea9b into devlooped:master Feb 27, 2019
@stakx stakx deleted the inner-mocks branch February 27, 2019 06:44
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