public void login(string user, string password)
        {
            HttpWebResponse firstresponse   = sendRequest(Constants.Urls.APP_URL, HttpMethod.GET);
            string          authContentType = "application/x-www-form-urlencoded";
            string          credentialsBody = String.Format("name={0}&password={1}", user, password);
            HttpWebResponse loginResponce   = sendRequest(Constants.Urls.LOGIN_URL, HttpMethod.POST, credentialsBody, authContentType);

            StatusCodeValidator.Validate("OK", loginResponce);
        }
Пример #2
0
        public void REST_GetAlltasks()
        {
            Console.WriteLine("------> getAllitems <------");
            Console.WriteLine("Get all Lists");
            HttpWebResponse getAllItemsresponse = client.getAllitems();

            Console.WriteLine("Validate response's  Status Code");
            StatusCodeValidator.Validate("OK", getAllItemsresponse);
            Console.WriteLine("Verify response's headers");
            Dictionary <String, String> expectedHeaders = new Dictionary <String, String>();

            expectedHeaders.Add("Content-Type", "application/json");
            HeadersValidator.Validate(expectedHeaders, getAllItemsresponse);
        }
Пример #3
0
        public void REST_CreateNewTask()
        {
            Console.WriteLine("------> createNewItems <------");
            Console.WriteLine("Create new List Item");
            string          taskName           = "NewTask_" + random.Next(1, 1000);
            string          taskDate           = today.ToString("yyyy-MM-dd");
            HttpWebResponse createItemResponse = client.createItems(Constants.Users.TEST_USER, taskName, taskDate);

            Console.WriteLine("Validate response's  Status Code");
            StatusCodeValidator.Validate("Created", createItemResponse);
            Console.WriteLine("Verify if task can be found by Date filter.");
            HttpWebResponse filterByDateResponse = client.filterListsByDate("=", taskDate);

            Assert.IsTrue(BodyValidator.verifyIfListItemIsPresent(taskName, taskDate, filterByDateResponse),
                          String.Format("Created listItem: {0} : {1}, can not be found by date filter.", taskName, taskDate));
        }