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

后端 未结 5 1543
南笙
南笙 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:48

    You can, but you really shouldn't. You should focus on testing the externall observable behaviors, rather than the implementation.

    Method call order can change without affecting the contract with the client of the API. In that case, your test will fail, even when it shouldn't.

    In short, testing implementation leads to brittle tests. Brittle tests lead to abandonment of the tests. You don't want to go there.

    Hope this helps.

提交回复
热议问题