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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access