June 21
Ninject – Dependancy Injection you dont want to fight with.
Ninject is a Depencancy Injection Container for asp.net, that provides the developer with the tools to decouple the architecture of an asp.net web application. Decoupling is the process of reducing the dependancies between the components of a project. Especaly when the component is used throughout the other components, like logging, utility and data access classes.
I will be using Ninject in the near future to allow mocking of a data access class in a new project. This will allow me to use a common interface to create two data access classes one of which talks to the application database and the other that uses the Rhino Mocks framework coupled with Ninject to substitute a fake data access class into the application and run the unit tests against it. This ensures that I am testing the code in my application rather than the connection to the database and the data. But what about testing the database I hear you cry. I will be using another set of unit tests to test the real data access class which includes testing the connection and expected results from the database.
Back to Ninject. I have had a look at the syntax and have looked at some of David Hayden’s posts on Ninject which all seam quite simple and easy to understand. I will let you all know how it turns out.
Popularity: 6% [?]


Hey Dave, be interested to hear howthisgoes, been using Nunit but I could do with a substituted data layer.