public void Can_Register_To_Container_By_Type_With_Generic_Method_Generate_Container_And_Resolve() { _sut.Register <TestClass>().As <ITestInterface>(); var container = _sut.GenerateContainer(); var result = container.Resolve <ITestInterface>(); Assert.IsType <TestClass>(result); }
public void Singleton_Registration_Creates_One_And_Only_One_Instance() { _sut.Register <TestClass>().As <ITestInterface>().WithLifestyle(RegistrationLifestyleType.Singleton); var container = _sut.GenerateContainer(); var v1 = container.Resolve <ITestInterface>(); var v2 = container.Resolve <ITestInterface>(); var v3 = container.Resolve <ITestInterface>(); Assert.Same(v1, v2); Assert.Same(v2, v3); Assert.Same(v1, v3); }
public void Setup() { service = new ContainerGenerator(); container = service.GenerateContainer(); }