WHAT IS DEPENDENCY INJECTION?
Faster development cycles demand unit tests and better updatability. Making some code changes should not result in errors in unexpected places. Creating more modular applications where dependencies are reduced helps with that.
Dependency injection (DI) allows injection dependencies from the outside of a class, thus the class where the dependency is injected only needs to know about a contract (usually a C# interface). The class can be independent of the creation of its objects.
Dependency injection allows for easier unit tests. With the unit test, only a specific class needs testing, and the dependencies needed can be replaced by a special ...