I see some good design benefits in DI, not just a good test design. Therefore, although I have Typemock and I can unit test without the IOC, I still prefer the DI constructor. I think this is a great way to quickly discover class dependencies.
Now I'm wondering if interfaces should be used as a type parameter in the constructor. They are very easy to create with Resharper, but it is still the type that I really don't need.
A quick example of what I mean
public interface IService { void Method(); } public class Service : IService { public void Method() { } } public class ClassThatUsesDI { public ClassThatUsesDI(IService service) **or** (Service service) { } }
What are your thoughts?
source share