Beispiel #1
0
        public void PostContentTypeTestLastId()
        {
            // arrange
            RestClient client = RestOperations.ReturnRestClient(baseURL);

            RestRequest request = RestOperations.ReturnPostRequest(postsEndPoint, lastId);


            // 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);

            RestRequest request = RestOperations.ReturnPostRequest(postsEndPoint, int.Parse(id));

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

            // assert
            Assert.That(response.StatusCode, Is.EqualTo(expectedHttpStatusCode));
        }
Beispiel #3
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 PostsEndPointDeserializationTest()
        {
            // arrange

            RestClient client = RestOperations.ReturnRestClient(baseURL);

            RestRequest request = RestOperations.ReturnPostRequest(postsEndPoint, firstId);

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

            PostsResponse postResponse = DesrializationOperation.PostDeserialize(response);

            // assert
            Assert.That(postResponse.ID, Is.EqualTo(firstId));
        }
Beispiel #5
0
        public void PostStatusCodeTestMultipleIds()
        {
            for (int idCheck = 1; idCheck <= 100; idCheck = idCheck + 10)
            {
                // arrange
                RestClient client = RestOperations.ReturnRestClient(baseURL);

                RestRequest request = RestOperations.ReturnPostRequest(postsEndPoint, idCheck);


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

                // assert
                Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
            }
        }
Beispiel #6
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;
            }
        }