public void Injector_Instantiate_ShouldResolveDependencies(Lifetime lifetime) { Container.Service <IInterface_1, Implementation_1_No_Dep>(lifetime); using (IInjector injector = Container.CreateInjector()) { Implementation_2_IInterface_1_Dependant obj = injector.Instantiate <Implementation_2_IInterface_1_Dependant>(); Assert.That(obj.Interface1, Is.InstanceOf <Implementation_1_No_Dep>()); } }
public void Injector_Instantiate_ShouldAcceptExplicitArguments() { var dep = new Implementation_1_No_Dep(); using (IInjector injector = Container.CreateInjector()) { Implementation_2_IInterface_1_Dependant obj = injector.Instantiate <Implementation_2_IInterface_1_Dependant>(new Dictionary <string, object> { { "interface1", dep } }); Assert.That(obj.Interface1, Is.SameAs(dep)); } }