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

Improve callback setup API to make it more obvious that the same result will be used instead of a delegate #20

Open
godrose opened this issue Dec 8, 2017 · 0 comments
Assignees

Comments

@godrose
Copy link
Owner

godrose commented Dec 8, 2017

Right now the following statement
var initialSetup = CreateInitialSetup(); var setup = initialSetup.AddMethodCallWithResult<Guid, Guid[]>( t => t.GetPhasesByGauge(It.IsAny<Guid>()), (r, id) => r.Complete(_phases[id].Select(t => t.Id).ToArray())); setup.Build();
will result in returning the same value each time
One should use
var initialSetup = CreateInitialSetup(); var setup = initialSetup.AddMethodCallWithResult<Guid, Guid[]>( t => t.GetPhasesByGauge(It.IsAny<Guid>()), (r, id) => r.Complete( k => _phases[k].Select(t => t.Id).ToArray())); setup.Build();
instead.
Pay attention to the difference in having the precalculated value and the delegate. It's not so obvious.

@godrose godrose self-assigned this Dec 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant