What's the correct way to setup multiple expectations on a method if you need a different return value for each consecutive invocation in Rhino.Mocks V3.6?
The following code used to work in V3.5 but fails in V3.6.
public void Test()
{
var mocks = new MockRepository();
var process = mocks.DynamicMock<IProcess>();
Expect.Call(process.Run()).Return(1);
Expect.Call(process.Run()).Return(2);
mocks.ReplayAll();
Assert.That(process.Run(), Is.EqualTo(1));
Assert.That(process.Run(), Is.EqualTo(2));
mocks.VerifyAll();
}
public interface IProcess
{
int Run();
}
I'm not sure if this is the correct way - but it works :)
The last time I needed this I created an extension method (although for Moq). Worked out pretty well for me..