Unit testing Rhino Mocks-如何断言一个被模拟的方法被调用了n次?
我如何断言模拟对象上的方法被精确调用了n次 以下是控制器操作的代码片段,我想测试:Unit testing Rhino Mocks-如何断言一个被模拟的方法被调用了n次?,unit-testing,tdd,rhino-mocks,Unit Testing,Tdd,Rhino Mocks,我如何断言模拟对象上的方法被精确调用了n次 以下是控制器操作的代码片段,我想测试: for (int i = 0; i <= newMatchCommand.NumberOfMatchesToCreate; i++) { serviceFacade.CreateNewMatch("tester", Side.White); } for(inti=0;i尝试Expect.Call(方法)。重复.Times(n)更好的方法是: mockObject.AssertWasCalled(x
for (int i = 0; i <= newMatchCommand.NumberOfMatchesToCreate; i++) {
serviceFacade.CreateNewMatch("tester", Side.White);
}
for(inti=0;i尝试Expect.Call(方法)。重复.Times(n)
更好的方法是:
mockObject.AssertWasCalled(x => x.SomeMethod(), opt => opt.Repeat.Times(n));
VerfiyAll()期望您返回一个对象,它抱怨您期望返回一些东西