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

Expose Mock.Setups, part 1: Basics #984

Merged
merged 9 commits into from
Mar 29, 2020
Merged

Conversation

stakx
Copy link
Contributor

@stakx stakx commented Mar 29, 2020

This exposes a mock's Setups collection in the public API. Setups accessible via that (for now read-only) collection are of type ISetup and (for now) have three properties that describe some basic aspects of each setup:

  • Expression
  • IsConditional
  • IsOverridden

This PR will be followed by a couple more that add more advanced functionality, e.g. to navigate the mock-setup or setup-setup object graph, and to perform custom verification.

It would be nice if `Mock.Setups` reported *all* setups instead of
just a subset. Given that as a goal, we will eventually need a way to
recognize such setups, so let's start by exposing these two flags.
@stakx stakx added this to the 4.14.0 milestone Mar 29, 2020
This is because up until now, the 'overridden' flags have been purely
an optimization to speed up future iterations over setups but correct-
ness of operation was guaranteed even without it. Since updating these
flags means some computational overhead, that update does not happen
in a "hot" code path, and therefore does not happen at the earliest
possible time.

Now that `IsOverridden` is exposed, eventual consistency is no longer
good enough, as this failing test demonstrates.
(A nice side effect of that is `Verify` and `VerifyAll` becoming more
self-documenting.)
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