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

Mock.Of<Class> shouldn't delete invocations made from Class' ctor #980

Merged
merged 3 commits into from
Mar 25, 2020

Conversation

stakx
Copy link
Contributor

@stakx stakx commented Mar 25, 2020

This hack introduced by yours truly in #543 has introduced inconsistent behavior between new Mock<T>() and Mock.Of<T>(): The latter will clear all invocations from the mock's Invocations collection — not just those caused by the library itself (as was intended), but also those caused by user code.

We can now safely remove that hack since we no longer use FluentMockVisitor (which was the component causing extraneous invocations).

One side effect of `FluentMockVisitor` (recently removed) was that it
caused extra invocations to be recorded during mock setup. We then had
to delete that record to give off the impression that new mocks are
truly untouched.

Unfortunately, this also caused invocations to be cleared that should
have stayed in the record.

We no longer use `FluentMockVisitor`, so no extra invocations are re-
corded in the first place.
@stakx stakx added this to the 4.14.0 milestone Mar 25, 2020
@stakx stakx merged commit 71d66d0 into devlooped:master Mar 25, 2020
@stakx stakx deleted the mock-of-invocations branch March 25, 2020 21:56
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