TDD, DDD and Encapsulation

后端 未结 8 1100
误落风尘
误落风尘 2021-02-01 05:19

After several years of following the bad practice handed down from \'architects\' at my place of work and thinking that there must be a better way, I\'ve recently been reading u

8条回答
  •  长发绾君心
    2021-02-01 05:37

    What you're describing is state verification wherein you Assert on the state of the domain object. There's a branch of TDD that is called behavior verification that utilizes Mock objects.

    Behavior verification allows you to specify which methods should be called and if you want, which methods aren't called.

    Look into this article by Martin Fowler for more details: Mocks Aren't Stubs.

提交回复
热议问题