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);
		}
示例#4
0
        public void Configuration(IAppBuilder app)
        {
            var startFlag = new StartFlag();

            var logger = SerilogConfig.Configure();

            var container = WindsorConfig.Configure(startFlag);
            var jsonSettings = JsonNetConfig.Configure(GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings);

            SignalRConfig.Configure(container, app, jsonSettings);
            WebApiConfig.Configure(container, jsonSettings);
            MvcConfig.Configure(container);

            BundleConfig.Configure();

            //ensure configuration of WebAPI is complete
            WebApiConfig.EnsureConfigured();

            startFlag.Signal();

        }