RhinoMock顺序调用
MockRepository mocks = new MockRepository(); ISongBird maleBird = (ISongBird)mocks.StrictMock(typeof(ISongBird)), femaleBird = (ISongBird)mocks.StrictMock(typeof(ISongBird)); using (mocks.Ordered()) { maleBird.Eat("seeds", 250); femaleBird.Eat("seeds", 250); } using (mocks.Ordered()) { maleBird.Mate(femaleBird); femaleBird.Mate(maleBird); } mocks.ReplayAll(); maleBird.Mate(femaleBird); femaleBird.Mate(maleBird); maleBird.Eat("seeds", 250); femaleBird.Eat("seeds", 250); mocks.VerifyAll();
总之用Ordered就可以次序调用了,上面是官方的例子。