Search code examples
unit-testingmvvmninject

System.NotImplementedException Ninject Unit Test


I'm trying to set up a StandardKernel for my unit tests however running this portion of the test causes a SystemNotImplementedException.

   [TestMethod]
    public void MyTestMethod()
    {
        var kernel = new StandardKernel();
        kernel.Bind<IView1>().To<View1>();
        kernel.Bind<IViewModel1>().To<ViewModel1>();
    }

Anyone have any ideas what the issue may be?

System.NotImplementedException was unhandled by user code
  HResult=-2147467263
  Message=The method or operation is not implemented.
  Source=Ninject
  StackTrace:
       at Ninject.Syntax.BindingRoot.Bind[T]()
       at Ninject.KernelBase..ctor(IComponentContainer components, INinjectSettings settings, INinjectModule[] modules)
       at Ninject.KernelBase..ctor(INinjectModule[] modules)
       at Ninject.StandardKernel..ctor(INinjectModule[] modules)
       at TESTMETHOD  in UNIT TEST LOCATION
  InnerException: 

Solution

  • The issue was the type of Ninject installed in the unit test project. The application is portable so all that was required was to reference portable Ninject instead of standard ninject.