public void RegisterInstance_Valid() { var helper = new UnityHelper(); var instance = new TestClass1() { Name = "test" }; var container = new UnityContainer(); Assert.IsFalse(container.IsRegistered(typeof(ITestInterface))); helper.RegisterInstance(container, typeof(ITestInterface), instance); Assert.IsTrue(container.IsRegistered(typeof(ITestInterface))); Assert.AreEqual(instance, container.Resolve <ITestInterface>()); }
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_Valid() { var helper = new WindsorHelper(); var instance = new TestClass1() { Name = "test" }; var container = new WindsorContainer(); Assert.IsNull(helper.GetRegistrationInfo(container, typeof(ITestInterface))); helper.RegisterInstance(container, typeof(ITestInterface), instance); Assert.IsTrue(container.Resolve <ITestInterface>() != null); Assert.AreEqual(instance, container.Resolve <ITestInterface>()); }
public void RegisterInstance_Valid() { var helper = new MefHelper(); var instance = new TestClass1() { Name = "test" }; var container = new CompositionContainer(); Assert.IsFalse(container.GetRegistrationInfo(typeof(ITestInterface))); helper.RegisterInstance(container, typeof(ITestInterface), instance); Assert.IsTrue(container.GetRegistrationInfo(typeof(ITestInterface))); Assert.AreEqual(instance, container.ResolveType <ITestInterface>()); }
public void RegisterInstance_Valid() { var helper = new WindsorHelper(); var instance = new TestClass1() { Name = "test" }; var container = new WindsorContainer(); Assert.IsNull(helper.GetRegistrationInfo(container, typeof(ITestInterface))); helper.RegisterInstance(container, typeof(ITestInterface), instance); Assert.IsTrue(container.Resolve<ITestInterface>() != null); Assert.AreEqual(instance, container.Resolve<ITestInterface>()); }
public void RegisterInstance_Valid() { var helper = new UnityHelper(); var instance = new TestClass1() { Name = "test" }; var container = new UnityContainer(); Assert.IsFalse(container.IsRegistered(typeof(ITestInterface))); helper.RegisterInstance(container, typeof(ITestInterface), instance); Assert.IsTrue(container.IsRegistered(typeof(ITestInterface))); Assert.AreEqual(instance, container.Resolve<ITestInterface>()); }
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>()); }