O'Reilly logo

Mastering Ninject for Dependency Injection by Daniel Baharestani

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Mocking Kernel

One of the advantages of Dependency Injection is that it improves the testability of code units and makes it even easier. Ninject has introduced Mocking Kernel, which facilitates the injection of mock objects. In this section, we will add a Test project to the Northwind solution and see how to use Mocking Kernel in order to write our unit tests. It is possible to extend Mocking Kernels for different isolation frameworks, and for some of them including RhinoMocks, Moq and NSubstitute, mocking kernel extensions already exist. In this example, we will use the Moq Mocking Kernel in combination with the NUnit framework to write some unit tests for the Northwind.Wpf project.

Add a new class library project named Northwind.Wpf.Test to the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required