public void CanSpecifyCustomLifestyle() { var myLifestyle = new CustomLifestyle(); store.Register(p => p.Service <IService>() .Implementor <ClassWithNoDependencies>() .Lifestyle.Custom(myLifestyle)); Assert.IsType <CustomLifestyle>(store.GetRegistrationsForService <IService>().First().Lifestyle); }
public void CustomLifestyle() { /* * Any instance implementing ILifestyle can be passed to the container. */ var store = new ComponentStore(); var myLifestyle = new CustomLifestyle(); store.Register(p => p.Service <IService>() .Implementor <ClassWithNoDependencies>() .Lifestyle.Custom(myLifestyle)); }
public void CanSpecifyCustomLifestyle() { var myLifestyle = new CustomLifestyle(); store.Register(p => p.Service<IService>() .Implementor<ClassWithNoDependencies>() .Lifestyle.Custom(myLifestyle)); Assert.IsType<CustomLifestyle>(store.GetRegistrationsForService<IService>().First().Lifestyle); }