Exemplo n.º 1
0
        public static void Start()
        {
            _server = new SelfHostHttpServer(5501, GetRootDirectory());
            var runtime = FubuApplication.For<HarnessRegistry>().StructureMap(new Container()).Bootstrap();


            _server.Start(runtime);

            var urls = runtime.Factory.Get<IUrlRegistry>();
            urls.As<UrlRegistry>().RootAt(_server.BaseAddress);

            UrlContext.Stub(_server.BaseAddress);

            _endpoints = new EndpointDriver(urls);
        }
Exemplo n.º 2
0
        public EmbeddedFubuMvcServer(FubuApplication application, string physicalPath = null, int port = 5500)
        {
            _application  = application;
            _physicalPath = physicalPath ?? AppDomain.CurrentDomain.BaseDirectory;

            _server  = new SelfHostHttpServer(port, physicalPath);
            _runtime = _application.Bootstrap();
            _server.Start(_runtime);

            _urls = _runtime.Factory.Get <IUrlRegistry>();
            //_urls.As<UrlRegistry>().RootAt(_server.BaseAddress);

            UrlContext.Stub(_server.BaseAddress);

            _services  = _runtime.Factory.Get <IServiceLocator>();
            _endpoints = new EndpointDriver(_urls, _server.BaseAddress);
        }
        public static void Start()
        {
            


            var rootDirectory = GetRootDirectory();
            new FileSystem().DeleteDirectory(rootDirectory.AppendPath(FubuMvcPackageFacility.FubuContentFolder));

            _server = new SelfHostHttpServer(5501, rootDirectory);

            FubuMvcPackageFacility.PhysicalRootPath = rootDirectory;
            var runtime = FubuApplication.For<HarnessRegistry>().StructureMap(new Container()).Bootstrap();
        
        
            _server.Start(runtime);

            var urls = runtime.Factory.Get<IUrlRegistry>();
            urls.As<UrlRegistry>().RootAt(_server.BaseAddress);

            UrlContext.Stub(_server.BaseAddress);

            _endpoints = new EndpointDriver(urls);
        }
Exemplo n.º 4
0
        public IApplicationUnderTest Start(ApplicationSettings settings, FubuRuntime runtime, IBrowserLifecycle lifecycle)
        {
            _server = new SelfHostHttpServer(settings.Port, settings.PhysicalPath);
            _server.Start(runtime);

            settings.RootUrl = _server.BaseAddress;

            return new ApplicationUnderTest(runtime, settings, lifecycle);
        }
Exemplo n.º 5
0
        public void Shutdown()
        {
            if (_server != null) _server.SafeDispose();

            _server = null;
        }
Exemplo n.º 6
0
        public Harness(FubuRuntime runtime, int port)
        {
            _runtime = runtime;

            _server = new SelfHostHttpServer(port, GetApplicationDirectory());
            _server.Start(runtime);
            _port = _server.Port;

            var urls = _runtime.Factory.Get<IUrlRegistry>();
            urls.As<UrlRegistry>().RootAt(_server.BaseAddress);

            UrlContext.Stub(_server.BaseAddress);

            _remote = new Lazy<RemoteBehaviorGraph>(() =>
            {
                return new RemoteBehaviorGraph(_server.BaseAddress);
            });

            _endpoints = new EndpointDriver(urls);
        }
Exemplo n.º 7
0
        public static void Start()
        {
            FubuMvcPackageFacility.PhysicalRootPath = GetRootDirectory();

            _server = new SelfHostHttpServer(5500, GetRootDirectory());
            var runtime = bootstrapRuntime();

            _server.Start(runtime);

            var urls = runtime.Factory.Get<IUrlRegistry>();
            urls.As<UrlRegistry>().RootAt(_server.BaseAddress);

            UrlContext.Stub(_server.BaseAddress);

            _endpoints = new EndpointDriver(urls);
        }
Exemplo n.º 8
0
        public bool RunAllSpecs()
        {
            string title = "Running Jasmine specs for project at " + _input.SerenityFile;
            Console.WriteLine(title);
            string line = "".PadRight(title.Length, '-');

            Console.WriteLine(line);

            buildApplication();
            bool returnValue = true;

            _server = new SelfHostHttpServer(_input.PortFlag, runningFolder());
            _server.Start(_application.BuildApplication().Bootstrap());

            _driver.NavigateTo<JasminePages>(x => x.AllSpecs());

            IWebDriver browser = _applicationUnderTest.Driver;
            Wait.Until(() => browser.FindElement(By.ClassName("finished-at")).Text.IsNotEmpty(),
                       timeoutInMilliseconds: _input.TimeoutFlag*1000);
            ReadOnlyCollection<IWebElement> failures = browser.FindElements(By.CssSelector("div.suite.failed"));

            if (_input.Mode == JasmineMode.run && _input.VerboseFlag)
            {
                browser.As<IJavaScriptExecutor>().ExecuteScript("$('#jasmine-reporter').show();");
                ReadOnlyCollection<IWebElement> logs = browser.FindElements(By.ClassName("jasmine-reporter-item"));
                logs.Each(message => Console.WriteLine(message.Text));
                browser.As<IJavaScriptExecutor>().ExecuteScript("$('#jasmine-reporter').hide();");
            }

            if (failures.Any())
            {
                returnValue = false;

                Console.WriteLine(line);
                writeFailures(failures);
            }

            Console.WriteLine();
            Console.WriteLine(line);
            writeTotals(browser);

            browser.Quit();
            browser.SafeDispose();
            _server.Dispose();

            return returnValue;
        }
Exemplo n.º 9
0
 private void run()
 {
     _server = new SelfHostHttpServer(_input.PortFlag, runningFolder());
     FubuRuntime runtime = _application.BuildApplication().Bootstrap();
     _server.Start(runtime);
     watchAssetFiles(runtime);
 }