Can I test method call order with AAA syntax in Rhino-Mocks 3.6?

后端 未结 5 1536
南笙
南笙 2020-12-19 01:19

Is it possible to test for the following example if the Method1 called 1st, then Method2 called after and then Method3 by using the AAA syntax, in Rhino-mocks 3.6 ?

5条回答
  •  抹茶落季
    2020-12-19 01:55

    Here's one way to do it...

    mock.AssertWasCalled(m=>m.Method1(), options => options.WhenCalled(w => mockService.AssertWasNotCalled(x=>x.Method2())));
    mock.AssertWasCalled(m=>m.Method2(), options => options.WhenCalled(w => mockService.AssertWasNotCalled(x=>x.Method3())));
    mock.AssertWasCalled(m=>m.Method3());
    

提交回复
热议问题