public void CanBuildUpExistingObjectOnTypeWithCtorWithRefParameter() { IUnityContainer container = new UnityContainer() .RegisterType<TypeWithConstructorWithRefParameter>(new InjectionProperty("Property", 10)); string ignored = "ignored"; TypeWithConstructorWithRefParameter instance = new TypeWithConstructorWithRefParameter(ref ignored); container.BuildUp(instance); Assert.AreEqual(10, instance.Property); }
public void CanBuildUpExistingObjectOnTypeWithCtorWithRefParameter() { IUnityContainer container = new UnityContainer() .RegisterType <TypeWithConstructorWithRefParameter>(new InjectionProperty("Property", 10)); string ignored = "ignored"; TypeWithConstructorWithRefParameter instance = new TypeWithConstructorWithRefParameter(ref ignored); container.BuildUp(instance); Assert.AreEqual(10, instance.Property); }
public void ResolvingANewInstanceOfTypeWithCtorWithRefParameterThrows() { IUnityContainer container = new UnityContainer(); try { TypeWithConstructorWithRefParameter instance = container.Resolve <TypeWithConstructorWithRefParameter>(); Assert.Fail("should have thrown"); } catch (ResolutionFailedException) { // expected } }
public void ResolvingANewInstanceOfTypeWithCtorWithRefParameterThrows() { IUnityContainer container = new UnityContainer(); Assert.Throws <ResolutionFailedException>(() => { TypeWithConstructorWithRefParameter instance = container.Resolve <TypeWithConstructorWithRefParameter>(); }); }