What should be the strategy of unit testing when using IoC?

后端 未结 4 1803
说谎
说谎 2021-02-12 23:29

After all what I have read about Dependency Injection and IoC I have decided to try to use Windsor Container within our application (it\'s a 50K LOC multi-layer web app, so I ho

4条回答
  •  情深已故
    2021-02-13 00:10

    As Darin has already pointed out, you don't need to use DI if you have mocks. (However, DI has a few other benefits as well, including, first of all, lessening dependencies in your code, which makes your code much easier to maintain and extend in the long run.)

    I personally prefer wiring up everything in my unit tests, thus relying as little as possible on external frameworks, config files etc.

提交回复
热议问题