private NancyHost CreateHost()
        {
            var bootstrapper = new Bootstrapper(this.container);

            var dashboardConfig = new DashboardConfiguration();

            return new NancyHost(bootstrapper, dashboardConfig.HostAddresses);
        }
        public void Signin_page_ok()
        {
            var bootstrapper = new Bootstrapper();
            var browser = new Browser(bootstrapper);

            var response = browser.Get("/signin", with => with.HttpRequest());
            
            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
        }
        public void Signout_should_redirect_to_signin_page()
        {
            var bootstrapper = new Bootstrapper();

            var browser = new Browser(bootstrapper);

            var response = browser.Get("/signout", with => with.HttpRequest());

            Assert.AreEqual(HttpStatusCode.SeeOther, response.StatusCode);

            response.ShouldHaveRedirectedTo("/signin");
        }
        public void Should_return_status_ok_when_route_exists()
        {
            var bootstrapper = new Bootstrapper();

            var browser = new Browser(bootstrapper);

            SignIn(browser);

            var response = browser.Get("/", with => with.HttpRequest());

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
        }
        public void Should_return_status_ok_when_route_exists()
        {
            var test = Consts.RequestPipelineKey; // Load BuildExplorer.Core into AppDomain

            var bootstrapper = new Bootstrapper();
            var browser = new Browser(bootstrapper);

            SignIn(browser);

            var response = browser.Get("/api/agents", with => with.HttpRequest());

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode);
        }
        public void Signin_should_redirect_to_default_page()
        {
            var bootstrapper = new Bootstrapper();
            
            var browser = new Browser(bootstrapper);

            var response = browser.Post("/signin", with =>
            {
                with.HttpRequest();
                with.FormValue("Email", "*****@*****.**");
                with.FormValue("Password", "password");
            });

            response.ShouldHaveRedirectedTo("/");
        }
        public void Should_redirect_to_login_with_error_details_incorrect()
        {
            // Given
            var bootstrapper = new Bootstrapper();
            var browser = new Browser(bootstrapper);

            // When
            var response = browser.Post("/signin", with =>
            {
                with.HttpRequest();
                with.FormValue("Email", "username");
                with.FormValue("Password", "wrongpassword");
            });

            // Then
            response.ShouldHaveRedirectedTo("/login?error=true&username=username");
        }