public void RegisterInstance_Valid() { var helper = new NinjectHelper(); var instance = new TestClass1() { Name = "test" }; var container = new StandardKernel(); Assert.IsFalse(GetRegistrationInfo(container, typeof(ITestInterface))); helper.RegisterInstance(container, typeof(ITestInterface), instance); Assert.IsTrue(GetRegistrationInfo(container, typeof(ITestInterface))); Assert.AreEqual(instance, container.Get <ITestInterface>()); }
public void RegisterInstance_InstanceNull() { var helper = new NinjectHelper(); var container = new StandardKernel(); ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => helper.RegisterInstance(container, typeof(ITestInterface), null)); }
public void RegisterInstance_InvalidContainer() { var helper = new NinjectHelper(); var container = new object(); ExceptionTester.CallMethodAndExpectException <NotSupportedException>(() => helper.RegisterInstance(container, typeof(ITestInterface), new TestClass1())); }
public void RegisterInstance_ContainerNull() { var helper = new NinjectHelper(); ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => helper.RegisterInstance(null, typeof(ITestInterface), new TestClass1())); }