Using Moq and TDD, where to start?

后端 未结 4 2203
灰色年华
灰色年华 2021-02-14 10:45

I have a server application and I was wondering where I should start if I want to start implementing TDD and using Moq.

What good books I could read on the subject, wh

4条回答
  •  北荒
    北荒 (楼主)
    2021-02-14 11:04

    Your code should evolve through the development of your tests, if you wish to the follow the TDD pattern. You'd be going for single-reponsibility and as mentioned mock/stub any dependencies the class you're testing has. This way you can setup dummy data and expected behaviours on any dependencies and not worry about them any further.

    This has a brief introduction: http://www.agiledata.org/essays/tdd.html unfortunately I don't have any specific book titles I can recommend from personal experience.

    Reading this may also be useful to get you started: http://stephenwalther.com/blog/archive/2008/06/12/tdd-introduction-to-moq.aspx

提交回复
热议问题