This is part 3 of my http://silk.codeplex.com/ review.
IoC miss usage is a most common problem in many applications and first thing I usually look at.
I choose random action method called Add from FillupController:
Do you see that Using stuff, let’s have a look:
What is more curious the FillUpController has no properties at all:
On the other hand there is a custom controller resolver which uses IoC Container.
Now testing a controller requires mocking IoC controller:
What I would do
- The simplest thing: extract interfaces from all instances resolved with Using register it in container and just put a property dependency.
- When you look closer at all that Using calls it’s kind of miss implemented CQRS( with all that handlers stuff in my last post), but the if project is so simple so why bother?