public void Can_manually_trigger_start_only_once()
        {
            var flag = new StartFlag();

            Startable.Started = false;
            Container.AddFacility <StartableFacility>(f => f.DeferredStart(flag));
            Container.Register(Component.For <Startable>().LifestyleTransient(),
                               Component.For <ICustomer>().ImplementedBy <CustomerImpl>());

            flag.Signal();
            Startable.Started = false;
            flag.Signal();
            Assert.IsFalse(Startable.Started);
        }
        public void Manually_triggered_start_throws_on_missing_dependencies()
        {
            var flag = new StartFlag();

            Startable.Started = false;
            Container.AddFacility <StartableFacility>(f => f.DeferredStart(flag));
            Container.Register(Component.For <Startable>());

            Assert.Throws <HandlerException>(() =>
                                             flag.Signal()
                                             );
        }
        public void Can_manually_trigger_start_when_using_Install()
        {
            var flag = new StartFlag();

            Startable.Started = false;
            Container.AddFacility <StartableFacility>(f => f.DeferredStart(flag));
            Container.Install(
                new ActionBasedInstaller(c => c.Register(Component.For <Startable>(),
                                                         Component.For <ICustomer>().ImplementedBy <CustomerImpl>()))
                );

            Assert.IsFalse(Startable.Started);

            flag.Signal();

            Assert.IsTrue(Startable.Started);
        }