public void Start()
        {
            _controller = _input.BuildRemoteController();
            var context = new StorytellerContext(_controller, _input);

            if (_controller.BinPath.IsEmpty())
            {
                throw new Exception("Could not determine any BinPath for the testing AppDomain. Has the Storyteller specification project been compiled, \nor is Storyteller using the wrong compilation target maybe?\n\ntype 'st.exe ? open' or st.exe ? run' to see the command usages\n\n");
            }

            context.Start();

            var registry = new FubuRegistry();


            registry.AlterSettings<DiagnosticsSettings>(_ => _.TraceLevel = TraceLevel.Verbose);
            registry.Mode = "development";
            registry.HostWith<NOWIN>();
            registry.Services.For<IRemoteController>().Use(_controller);
            registry.Services.For<StorytellerContext>().Use(context);
            
            registry.Services.IncludeRegistry<WebApplicationRegistry>();


            _server = registry.ToRuntime();
        }
        public void Initialize(Type applicationType, StartApplication message)
        {
            _registry = Activator.CreateInstance(applicationType).As<FubuRegistry>();
            _registry.RootPath = message.PhysicalPath;
            _registry.Port = PortFinder.FindPort(message.PortNumber);
            _registry.Mode = message.Mode;

            _registry.AlterSettings<OwinSettings>(owin =>
            {
                owin.AddMiddleware<HtmlHeadInjectionMiddleware>().Arguments.With(new InjectionOptions
                {
                    Content = c => message.HtmlHeadInjectedText
                });
            });

            if (_registry.Host == null) _registry.HostWith<Katana>();

            StartUp();
        }
        private FubuRuntime serverFor(Action<OwinSettings> action)
        {
            var registry = new FubuRegistry();
            registry.AlterSettings(action);
            registry.HostWith<Katana>();

            return registry.ToRuntime();
        }