Пример #1
0
        public void CommentContentTypeTestFirstId()
        {
            // arrange
            RestClient client = RestOperations.ReturnRestClient(baseURL);

            string commentEndPoint = postsEndPoint + firstId + commentsPostsEndPoint;

            RestRequest request = RestOperations.ReturnCommentRequest(commentEndPoint);

            // act
            IRestResponse response = RestOperations.ExecuteRequest(client, request);

            // assert
            Assert.That(response.ContentType, Is.EqualTo(contentType));
        }
        public void StatusCodeTest(string id, HttpStatusCode expectedHttpStatusCode)
        {
            // arrange

            RestClient client = RestOperations.ReturnRestClient(baseURL);

            string commentEndPoint = postsEndPoint + id + commentsPostsEndPoint;

            RestRequest request = RestOperations.ReturnCommentRequest(commentEndPoint);


            // act

            IRestResponse response = RestOperations.ExecuteRequest(client, request);

            // assert
            Assert.That(response.StatusCode, Is.EqualTo(expectedHttpStatusCode));
        }
Пример #3
0
        public void CommentStatusCodeTestMultipleIds()
        {
            for (int idCheck = 1; idCheck <= 100; idCheck = idCheck + 10)
            {
                // arrange
                RestClient client = RestOperations.ReturnRestClient(baseURL);

                string commentEndPoint = postsEndPoint + idCheck + commentsPostsEndPoint;

                RestRequest request = RestOperations.ReturnCommentRequest(commentEndPoint);


                // act
                IRestResponse response = RestOperations.ExecuteRequest(client, request);

                // assert
                Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
            }
        }
Пример #4
0
        public void CommentEndPointDeserializationTests()
        {
            // arrange
            RestClient client = RestOperations.ReturnRestClient(baseURL);

            string commentEndPoint = postsEndPoint + firstId + commentsPostsEndPoint;

            RestRequest request = RestOperations.ReturnCommentRequest(commentEndPoint);

            // act
            var response = RestOperations.ExecuteCommentRequest(client, request);

            var commentObject = DesrializationOperation.CommentDeserialize(response);

            // assert
            foreach (Comment obj in commentObject)
            {
                Assert.That(obj.ID[0], Is.EqualTo(firstId));
                break;
            }
        }