public void GetRegistrationInfo_ContainerWithoutTypeRegistered() { var helper = new WindsorHelper(); var container = new WindsorContainer(); Assert.IsNull(helper.GetRegistrationInfo(container, typeof(ITestInterface))); }
public void RegisterType_Valid() { var helper = new WindsorHelper(); var container = new WindsorContainer(); Assert.IsNull(helper.GetRegistrationInfo(container, typeof(ITestInterface))); helper.RegisterType(container, typeof(ITestInterface), typeof(TestClass1), RegistrationType.Singleton); Assert.IsTrue(container.Resolve <ITestInterface>() != null); }
public void GetRegistrationInfo_ContainerWithTransientTypeRegistered() { var helper = new WindsorHelper(); var container = new WindsorContainer(); container.Register(new IRegistration[] { new ComponentRegistration <ITestInterface>().ImplementedBy <TestClass1>().LifestyleTransient() }); var registrationInfo = helper.GetRegistrationInfo(container, typeof(ITestInterface)); Assert.AreEqual(typeof(ITestInterface), registrationInfo.DeclaringType); Assert.AreEqual(RegistrationType.Transient, registrationInfo.RegistrationType); }
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 GetRegistrationInfo_InvalidContainer() { var helper = new WindsorHelper(); var container = new object(); ExceptionTester.CallMethodAndExpectException <NotSupportedException>(() => helper.GetRegistrationInfo(container, typeof(ITestInterface))); }
public void GetRegistrationInfo_InterfaceTypeNull() { var helper = new WindsorHelper(); var container = new WindsorContainer(); ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => helper.GetRegistrationInfo(container, null)); }
public void GetRegistrationInfo_ContainerNull() { var helper = new WindsorHelper(); ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => helper.GetRegistrationInfo(null, typeof(ITestInterface))); }