title: How pass different repository object with same interface to my service layer using Ninject?
body: <p>So I've run into this confusion in the past, and got around it by just not using Ninject. Now that I'm redoing my site I'm at a point where Ninject seems to be handy again, but I've got myself confused. <em>Again</em>.</p>
  
  <p>I have an MVC3 project using a repository pattern. Currently, my Home Controller creates a few objects like OrderRepository.cs, CustomerRepository.cs and sends them to a service called OrderService.cs and CustomerService.cs. I have a Test project that I can use to send in FakeOrderRepository.cs and FakeCustomerRepository.cs. This is handy for unit testing as I go through my project.</p>
  
  <p>However, I realise that by declaring the repositories in my Controller and unit tests, I'm setting up a dependency on those objects. What I would like to do is have no repositories passed, and have my Service layer use Ninject to say "Oh look, IOrderRepository is in my constructor, I better go get OrderRepository".</p>
  
  <p>The issue I ran into last time is that while I can bind OrderRepository to any instance or IOrderRepository in a contructor and bind the two together in my Global.ascx, this seems to leave my unit tests high and dry. Unless I go in and switch every bind in my Global.ascx with the object I want passed in (in this case, FakeOrderRepository.cs) every time I run tests, my real repository will be passed in. How can I have my Test project and Controller pass different repositories while using the same IOrderRepository interface?</p>
  
  <p>Whew, long explanation for something that is probably simple. I have a feeling I'm overthinking this and just missing a few key understandings.</p>
  
  <p><strong>tldr:</strong> How can I have a constructor in my service layer and pass in a different repository objects from my Controllers and Unit Tests using Ninject.</p>