Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 1
    I don't agree. If you consider it a goal that you unit test as many methods, classes, etc. as you can, then your answer implies that you can never have one method or class call another directly without DI. Before you know it, you'll have an interface and factory for every method in the system! Just so you can unit test methods that simply call other methods. Now you run the risk of objects being built wrong. This sort of complexity can add more bugs than it prevents. Commented Jun 15, 2014 at 21:22
  • 1
    @Brandon: surely you can test classes which don't use DI and call other static methods directly - its just that the test becomes harder, or you have to test things twice (like in the example above). That's the point of my answer. Commented Jun 16, 2014 at 5:50