Moq/moq4 — pull request #72 by halllo (2013-12-14 16:25:35+00:00)
Title: InSequence-Setups can now be used on the same mock instance.

The MockSequence conditional can now be evaluated many times without side effects because the side effect can be triggered explicitly.

I basically separated the evaluation of the condition and the side effect
```csharp
// HACK assume condition is only
// evaluated once. issues to attach callback lately.
return mock.When(() =>
{
var c = expectationPosition == sequenceStep;
if (c)
{
this.NextStep();
}
return c;
});
```
to look like
```csharp
return mock.When(new Condition(
condition: () => expectationPosition == sequenceStep,
success: NextStep));
```
In order to verify, I added these two tests
```csharp
[Fact]
public void SameMockRightSequenceSuccess()
{
var a = new Mock(MockBehavior.Strict);

var sequence = new MockSequence();
a.InSequence(sequence).Setup(x => x.Do(100)).Returns(101);
a.InSequence(sequence).Setup(x => x.Do(200)).Returns(201);

Assert.Equal(101, a.Object.Do(100));
Assert.Equal(201, a.Object.Do(200));
Assert.Throws(() => a.Object.Do(100));
Assert.Throws(() => a.Object.Do(200));
}

[Fact]
public void SameMockInvalidSequenceFail()
{
var a = new Mock(MockBehavior.Strict);

var sequence = new MockSequence();
a.InSequence(sequence).Setup(x => x.Do(100)).Returns(101);
a.InSequence(sequence).Setup(x => x.Do(200)).Returns(201);

Assert.Throws(() => a.Object.Do(200));
}
```