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);
        }
Exemple #2
0
        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);
        }