Exemplo n.º 1
0
        public static string DownloadPageAsAdmin(string relativePath)
        {
            relativePath += relativePath.Contains("?") ? "&_auth=basic" : "?_auth=basic";

            WebClient client = new WebClient();

            client.Credentials = DatabaseAutomation.GetAdminCredential();
            return(client.DownloadString(new Uri(DatabaseAutomation.GetDatabaseUrl(), relativePath)));
        }
Exemplo n.º 2
0
        public static string PostJsonAsAdmin(string relativePath, string post)
        {
            relativePath += relativePath.Contains("?") ? "&_auth=basic" : "?_auth=basic";

            WebClient client = new WebClient();

            client.Headers.Add(HttpRequestHeader.ContentType, "application/json");
            client.Credentials = DatabaseAutomation.GetAdminCredential();
            return(client.UploadString(new Uri(DatabaseAutomation.GetDatabaseUrl(), relativePath), post));
        }
Exemplo n.º 3
0
        public static Browser GetAdminBrowser()
        {
            Browser b    = GetBrowserAtUrl(new Uri(DatabaseAutomation.GetDatabaseUrl(), "Account/Login"));
            var     cred = DatabaseAutomation.GetAdminCredential();

            b.Find.ById <HtmlInputText>("username").Text     = cred.UserName;
            b.Find.ById <HtmlInputPassword>("password").Text = cred.Password;
            b.Find.ById <HtmlInputSubmit>("login").Click();
            return(b);
        }