public void ResolveType_Transient() { var helper = new WindsorHelper(); var container = new WindsorContainer(); container.Register(new IRegistration[] { new ComponentRegistration<ITestInterface>().ImplementedBy<TestClass1>().LifestyleTransient() }); var resolvedInstance1 = helper.ResolveType(container, typeof(ITestInterface)); Assert.IsNotNull(resolvedInstance1); Assert.IsInstanceOfType(resolvedInstance1, typeof(TestClass1)); var resolvedInstance2 = helper.ResolveType(container, typeof(ITestInterface)); Assert.IsNotNull(resolvedInstance2); Assert.IsInstanceOfType(resolvedInstance2, typeof(TestClass1)); Assert.IsFalse(ReferenceEquals(resolvedInstance1, resolvedInstance2)); }
public void ResolveType_ContainerWithoutTypeRegistered() { var helper = new WindsorHelper(); var container = new WindsorContainer(); ExceptionTester.CallMethodAndExpectException<NotSupportedException>(() => helper.ResolveType(container, typeof(ITestInterface))); }
public void ResolveType_InterfaceTypeNull() { var helper = new WindsorHelper(); var container = new WindsorContainer(); ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => helper.ResolveType(container, null)); }
public void ResolveType_InvalidContainer() { var helper = new WindsorHelper(); var container = new object(); ExceptionTester.CallMethodAndExpectException<NotSupportedException>(() => helper.ResolveType(container, typeof(ITestInterface))); }
public void ResolveType_ContainerNull() { var helper = new WindsorHelper(); ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => helper.ResolveType(null, typeof(ITestInterface))); }