I’ve gotten really used to writing my controller constructors like this…

public SomeController(IAppContext appContext, IRepository repository) {
    _appContext = appContext;
    _repository = repository;
}

And that’s fine, I suppose. Honestly, though, I don’t really like it. Instead, I like how FubuMVC embraces the fact that its built with IoC in mind. Is it really easier to test a controller like this? Why not build a controller factory for testing purposes which populates a testing service factory with all of my mocks.

Then I could just say something like this…

public ActionResult Show(int id) {
    var person = ServiceFactory.Data
        .GetRepositoryFor<Person>()
        .Single(x => x.Id == id && x.Active);
    return View(person);
}

No need for a default constructor at all. The controller is that much simpler. Certainly worth a ponder.