Improving MoQ to allow arrange-act-assert testing style
Today, the MoQ API lets you setup expectations and later verify them, like so:
[Fact]
public void FillingRemovesInventoryIfInStock()
{
//arrange/setup
var order = new Order(TALISKER, 50);
var mock = new Mock<IWarehouse>();
//setup - expectations
mock.Expect(x => x.HasInventory(TALISKER, 50)).Returns(true);
//act
order.Fill(mock.Object);
//assert
Assert.True(order.IsFilled);
//verify interaction
mock.VerifyAll();
}