public void InjectProperties_UnknownClassWithPropertyDependencyRegisteredAsInstance_InjectsPropertyDependencies() { var container = CreateContainer(); container.RegisterInstance <IBar>(new Bar()); var fooWithProperyDependency = new FooWithPropertyDependency(); var result = (FooWithPropertyDependency)container.InjectProperties(fooWithProperyDependency); Assert.IsAssignableFrom <Bar>(result.Bar); }
public void InjectProperties_KnownClassWithPropertyDependency_InjectsPropertyDependencies() { var container = CreateContainer(); container.Register <FooWithPropertyDependency>(); container.Register <IBar, Bar>(); var fooWithProperyDependency = new FooWithPropertyDependency(); var result = (FooWithPropertyDependency)container.InjectProperties(fooWithProperyDependency); Assert.IsAssignableFrom <Bar>(result.Bar); }
public void InjectProperties_FuncFactory_InjectsPropertyDependencies() { var container = CreateContainer(); container.Register <IBar, Bar>(); container.Register <IBar, AnotherBar>("AnotherBar"); container.Register(f => new FooWithPropertyDependency() { Bar = f.GetInstance <IBar>("AnotherBar") }); var fooWithProperyDependency = new FooWithPropertyDependency(); var result = (FooWithPropertyDependency)container.InjectProperties(fooWithProperyDependency); Assert.IsAssignableFrom <Bar>(result.Bar); }