public void Redirects_To_Setup_Page_When_No_Config() { var browser = new BrowserBuilder().WithoutConfiguration().Build(); var response = browser.Get("/", with => with.HttpRequest()); response.ShouldHaveRedirectedTo("/setup/1/"); }
public TrackingModuleFixture() { _xpTracking = new Mock <IXpTracking>(); var module = new TrackingModule(_xpTracking.Object); _browser = BrowserBuilder.CreateNullBrowserForLogicTests(module); }
public AuthenticationModuleFixture() { _userRegistration = new Mock <IUserRegistration>(); var module = new AuthenticationModule(_userRegistration.Object); _browser = BrowserBuilder.CreateNullBrowserForLogicTests(module); }
public void Can_Show_Setup_Page() { var browser = new BrowserBuilder().WithoutConfiguration().Build(); var response = browser.Get("/setup/1/", with => with.HttpRequest()); ServantAsserts.ResponseIsOkAndContainsData(response); }
public IntegrationsModuleFixture() { _integrationProviders = new Mock <IIntegrationProviders>(); var module = new IntegrationsModule(_integrationProviders.Object); _browser = BrowserBuilder.CreateNullBrowserForLogicTests(module); }
public void Blocks_Setup_Page_When_Already_Installed() { var browser = new BrowserBuilder().WithDefaultConfiguration().Build(); var response = browser.Get("(/setup/1/", with => with.HttpRequest()); Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode); }
public void Can_Create_Site() { Cleanup(); var browser = new BrowserBuilder().WithDefaultConfiguration().Build(); var response = browser.Post("/sites/create/", with => { with.Authenticated(); with.HttpRequest(); with.FormValue("name", _testSite.Name); with.FormValue("sitepath", @"c:\inetpub\wwwroot"); with.FormValue("bindingsuserinput", "http://unit-test-site.com"); with.FormValue("bindingsipaddress", "*"); with.FormValue("bindingscertificatename", "Servant"); with.FormValue("applicationpool", ""); }); var body = response.Body.AsString(); var urlRegex = new Regex(@"/sites/(\d+)/settings", RegexOptions.IgnoreCase); string headerLocation; response.Headers.TryGetValue("Location", out headerLocation); Assert.IsTrue(urlRegex.IsMatch(headerLocation ?? "")); }
public BrowserModel GenerateBrowser(BrowserBuilder browserBuilder) { browserBuilder.GetBrowserName(); browserBuilder.GetBrowserVersion(); var resultModel = browserBuilder.Build(); return(resultModel); }
public static void Before() { Browser = BrowserBuilder.ObterBrowser( ScenarioContext.Current.ScenarioInfo.Tags.FirstOrDefault(f => f == "chrome" || f == "firefox" || f == "ie")); Thread.Sleep(1000); Browser.Iniciar(); ScenarioContext.Current.Add("browser", Browser); }
public void Cannot_Show_Home_Page_With_Wrong_Credentials() { var browser = new BrowserBuilder().WithDefaultConfiguration().Build(); var response = browser.Get("/", with => { with.BasicAuth("wronguser", "wrongpass"); with.HttpRequest(); }); Assert.AreEqual(HttpStatusCode.Unauthorized, response.StatusCode); }
public void Can_Show_Home_Page() { var browser = new BrowserBuilder().WithDefaultConfiguration().Build(); var response = browser.Get("/", with => { with.Authenticated(); with.HttpRequest(); }); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); }
public void Can_Show_CreateSite_Page() { var browser = new BrowserBuilder().WithDefaultConfiguration().Build(); var response = browser.Get("/sites/create", with => { with.Authenticated(); with.HttpRequest(); }); ServantAsserts.ResponseIsOkAndContainsData(response); }
public void Can_Delete_Site() { var browser = new BrowserBuilder().WithDefaultConfiguration().Build(); var originalSite = GetTestSiteFromIis(); var response = browser.Post("/sites/" + originalSite.IisId + "/delete/", with => { with.Authenticated(); with.HttpRequest(); }); response.ShouldHaveRedirectedTo("/"); }
public void Can_Show_Settings_Page() { var testSite = GetTestSiteFromIis(); var browser = new BrowserBuilder().WithDefaultConfiguration().Build(); var response = browser.Get("/sites/" + testSite.IisId + "/settings/", with => { with.HttpRequest(); with.Authenticated(); }); ServantAsserts.ResponseIsOkAndContainsData(response); }
public void Can_Save_Configuration() { var browser = new BrowserBuilder().WithoutConfiguration().Build(); const string servantUrl = "http://localhost:54444/"; var response = browser.Post("/setup/1/", with => { with.FormValue("servanturl", servantUrl); with.FormValue("username", "admin"); with.FormValue("password", "servant"); with.FormValue("autosendcrashreport", "true"); with.FormValue("acceptterms", "true"); }); response.ShouldHaveRedirectedTo("/setup/confirm/?url=" + HttpUtility.UrlEncode(servantUrl)); }
public void Can_Create_Application() { var browser = new BrowserBuilder().WithDefaultConfiguration().Build(); var site = GetTestSiteFromIis(); var response = browser.Post("/sites/" + site.IisId + "/applications/", with => { with.Authenticated(); with.HttpRequest(); with.FormValue("path", "virtualapptest"); with.FormValue("applicationpool", site.ApplicationPool); with.FormValue("diskpath", "C:"); }); var body = response.Body.AsString(); StringAssert.Contains("var message = \"Applications have been saved.\";", body); }
public void Cannot_Create_Application_With_Invalid_Path() { var browser = new BrowserBuilder().WithDefaultConfiguration().Build(); var site = GetTestSiteFromIis(); var response = browser.Post("/sites/" + site.IisId + "/applications/", with => { with.Authenticated(); with.HttpRequest(); with.FormValue("path", "virtual%¤#<*>apptest"); with.FormValue("applicationpool", site.ApplicationPool); with.FormValue("diskpath", "C:"); }); var body = response.Body.AsString(); StringAssert.Contains("Path cannot contain the following characters", body); }
public static void Before() { //ProcessStartInfo startInfo = new ProcessStartInfo(); //startInfo.FileName = "cmd.exe"; //startInfo.Arguments = "/c taskkill /im chrome.exe /f"; //Process.Start(startInfo); //startInfo.Arguments = "/c taskkill /im chromedriver.exe /f"; //Process.Start(startInfo); Browser = BrowserBuilder.ObterBrowser( ScenarioContext.Current.ScenarioInfo.Tags.FirstOrDefault(f => f == "chrome" || f == "firefox" || f == "ie")); Thread.Sleep(1000); Browser.Iniciar(); ScenarioContext.Current.Add("browser", Browser); }
public void Can_Save_Settings() { var browser = new BrowserBuilder().WithDefaultConfiguration().Build(); var configuration = Nancy.TinyIoc.TinyIoCContainer.Current.Resolve <ServantConfiguration>(); BrowserResponse response = browser.Post("/settings/", with => { with.Authenticated(); with.HttpRequest(); with.FormValue("servanturl", configuration.ServantUrl); with.FormValue("debug", true.ToString()); with.FormValue("autosendcrashreport", true.ToString()); with.FormValue("username", configuration.Username); with.FormValue("password", "servant"); }); configuration = ConfigurationHelper.GetConfigurationFromDisk(); Assert.AreEqual(true, configuration.Debug); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); }
public void Can_Save_Site_Settings() { var browser = new BrowserBuilder().WithDefaultConfiguration().Build(); var originalSite = GetTestSiteFromIis(); var response = browser.Post("/sites/" + originalSite.IisId + "/settings/", with => { with.Authenticated(); with.HttpRequest(); with.FormValue("name", originalSite.Name); with.FormValue("sitepath", originalSite.SitePath); with.FormValue("bindingsuserinput", "http://unit-test-site-edited.com"); with.FormValue("bindingsipaddress", "*"); with.FormValue("bindingscertificatename", "Servant"); with.FormValue("applicationpool", originalSite.ApplicationPool); }); var body = response.Body.AsString(); StringAssert.Contains("var message = \"Settings have been saved.\"", body); }
public void Cannot_Save_Site_Settings_With_Errors() { var browser = new BrowserBuilder().WithDefaultConfiguration().Build(); var originalSite = GetTestSiteFromIis(); var response = browser.Post("/sites/" + originalSite.IisId + "/settings/", with => { with.Authenticated(); with.HttpRequest(); with.FormValue("name", originalSite.Name); with.FormValue("sitepath", originalSite.SitePath); with.FormValue("bindingsuserinput", "http://unit-test-site-edite%%d.com"); with.FormValue("bindingsipaddress", "*"); with.FormValue("bindingscertificatename", "Servant"); with.FormValue("applicationpool", originalSite.ApplicationPool); }); Assert.AreEqual(response.StatusCode, HttpStatusCode.OK); var body = response.Body.AsString(); StringAssert.Contains("\"Message\":\"The binding is invalid.\",\"PropertyName\":\"bindingsuserinput[0]\"", body); }