if you have an interface:
public interface ILuckynumberService
{
int GetMyLuckyNumber();
}
And if you generate a stub for this interface like below, how can you enforce it to return 5 on the first call, then 7 on the second and 11 on the third call?
stubLuckyService = MockRepository.GenerateStub<ILuckyService>();
// Now, how to arrange stubLuckyService here?
Here is how I would do it, although there may be a more straight forward way of doing it:
var results = new[] {5, 7, 11};
var count = 0;
service.Expect(x => x.GetMyLuckyNumber()).Return(0)
.WhenCalled(x => {
x.ReturnValue = results[count];
count++;
});