tags:

views:

18

answers:

1

I am trying to unit test a controller that already has a constructor dependency injection. How do I also pass the dependency injection to the unit test? I am using the Ninject to do the DI in the controller but I have never unit tested anything so this is new for me.

+2  A: 

Normally, you pass constructor dependencies manually from your unit test. This allows you to test a small piece of your software by passing in mocks or doubles of the dependencies. We have a fairly large system and have never needed to use our injection framework for a unit test.

The injection framework is used for production and for integration tests where you are wiring together many components.

Rob