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 6: Replace OriginalSetup with simpler OriginalExpression #999

Merged
merged 1 commit into from
Apr 17, 2020

Conversation

stakx
Copy link
Contributor

@stakx stakx commented Apr 17, 2020

(This is a follow-up to #995.)

There are several problems with the current ISetup ISetup.OriginalSetup { get; }:

  1. The IFluentSetups that can be returned via this property aren't really working setups; they're inert data objects used mostly for introspection. This means we have several things in the code base that call themselves "setups", yet are basically apples and oranges.

  2. Setup expressions are always lambdas. This may be too restrictive if at a later time we e.g. want to link stubbed property accessor setups to a specific mock.SetupAllProperties() call.

  3. IFluentSetup may simply be quite difficult to understand; also, it might not be obvious that there's more functionality available when explicitly casting OriginalSetup to IFluentSetup.

For those reasons, let's replace OriginalSetup with a much simpler solution: a Expression OriginalExpression { get; } property, which should be sufficient in most scenarios and is quite easy to grasp.

@stakx stakx added this to the 4.14.0 milestone Apr 17, 2020
Takes away some unneeded complexity, and may be simpler to understand.
@stakx stakx merged commit 8dfe12a into devlooped:master Apr 17, 2020
@stakx stakx deleted the mock-setups-6 branch April 17, 2020 20:02
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