Dependency injection and unit test
It is wonderful when a domain class that I want to test depends upon stateless objects, I can use dependency inject to do all the tricks so that I can test the function that I would like on the class. But what if the objects upon which the domain class depends are stateful? Can I still employ the dependency inject technique in this case? What I mean by "stateful object" is an object whose state is initialized through a constructor. Can you still use DI container to do the initialization?
链接地址: http://www.djcxy.com/p/82276.html上一篇: 什么是依赖注入上下文中的组合根
下一篇: 依赖注入和单元测试