Your DependencyResolver example is not much better than your source code, so yes .. there is not much benefit from this.
Fortunately, this is not how you should do it. Instead, you use a constructor or property nesting.
I agree with @adriaanp, lighter unit testing is only a side benefit of dependency injection. The biggest benefit is that it encourages a dependency-free architecture. Your classes are autonomous and independent of a specific implementation (except for the interface and requirements).
Another benefit is that the IoC container can control the life of your dependencies. Suppose you want an object to exist for the lifetime of a request on a web page. Also suppose you want to access this object in many different classes. You can create an object in the page load event, and then pass it to each object that you create it. However, this may mean that you need to pass it to objects that do not actually use them, simply because they create objects that need it (or create objects that create objects that need it, or ... etc.).
When using dependency injection and an IoC container, the container controls the lifetime of the object, and it deals with injecting it into the objects that need it. You do not need to create this in your projects. You just get it for free.
And finally, for the testing problem. When you check something, if there is a hard-coded new one there, you cannot easily replace it with a mocked object to pass it to test data. Suppose you want to verify that the object is calculating the value correctly. Providing test data with known values simplifies testing.
source share