Using IoC for Unit Testing

前端 未结 4 2066
一个人的身影
一个人的身影 2020-11-22 12:13

How can a IoC Container be used for unit testing? Is it useful to manage mocks in a huge solution (50+ projects) using IoC? Any experiences? Any C# libraries that work well

4条回答
  •  Happy的楠姐
    2020-11-22 13:02

    Using containers with ability to resolve unregistered/uknown services like SimpleInjector, DryIoc (its mine) can return mocks for not yet implemented interfaces.

    Which means that you can start development with first simple implementation and its mocked dependencies, and replace them with real thing as you progress.

提交回复
热议问题