public void Registering_Multiple_Types_Should_Resolve_All_Types() { var builder = new SimpleInjectorObjectBuilder(); builder.Configure(typeof(FirstImplementation), DependencyLifecycle.InstancePerUnitOfWork); builder.Configure(typeof(SecondImplementation), DependencyLifecycle.InstancePerUnitOfWork); builder.Configure(typeof(ThirdImplementation), DependencyLifecycle.InstancePerUnitOfWork); var allTypes = builder.BuildAll(typeof(IInterface)); Assert.AreEqual(3, allTypes.Count()); }
public void Passing_A_Func_Uses_The_Func_To_Resolve() { var builder = new SimpleInjectorObjectBuilder(); var funcCalled = false; Func <TestType> reg = () => { funcCalled = true; return(new TestType()); }; builder.Configure(reg, DependencyLifecycle.InstancePerCall); var resolve = builder.Build(typeof(TestType)); Assert.True(funcCalled); }