tags:

views:

284

answers:

1

Is there, if any? :

    var storage = mocks.DynamicMock<IStorage>();

...

    SetupResult.For(storage.GetCustomers())
        .Return(new Collection<Customer> { cust1, cust2 });

            // and

    storage.Stub(x => x.Customers)
        .Return(new Collection<Customer> { cust1, cust2 });
+3  A: 

EDIT: I hadn't seen the Stub extension method before, only the method on the repository.

I suspect that the main difference is that you can call Stub when the mock is in either mode (replay or record). It will set it back to record mode temporarily, record the action, and then revert to replay if it started off in replay mode.

It also lets you stub out multiple actions in one lambda expression, so long as you only need one of the actions (the last one) to return a result.

Jon Skeet