コード例 #1
0
        public void Test_GzipStreamEncoding()
        {
            var cookieContainer = new CookieContainer();

            var client = new CommonFunctionalityClient(cookieContainer, SITE_URL);

            client.UseGzipEncoding = true;
            var task = client.LoginPost(PASSWORD, USERNAME);

            task.Wait();
            var httpClient = task.Result;

            Assert.IsTrue(httpClient.Response.StatusCode == HttpStatusCode.OK);
        }
コード例 #2
0
        public void Test_LevelManagement()
        {
            const string GAME_ID         = "25186";
            var          cookieContainer = new CookieContainer();

            var client    = new CommonFunctionalityClient(cookieContainer, SITE_URL);
            var taskLogin = client.LoginPost(PASSWORD, USERNAME);

            taskLogin.Wait();
            var task = client.LevelManagement(GAME_ID);

            task.Wait();
            var    httpClient = task.Result;
            string htmlPage   = httpClient.GetResponseString();

            Assert.IsTrue(htmlPage.Contains("Level"));
        }
コード例 #3
0
        public void Test_Login()
        {
            var cookieContainer = new CookieContainer();

            var client = new CommonFunctionalityClient(cookieContainer, SITE_URL);
            var task   = client.LoginPost(PASSWORD, USERNAME);

            task.Wait();
            var httpClient = task.Result;

            Assert.IsTrue(httpClient.Response.StatusCode == HttpStatusCode.OK);
            var responseCookies = cookieContainer.GetAllCookies();


            var authCookie = responseCookies["atoken"];

            Assert.IsNotNull(authCookie);
        }