[TestCase("17", 6)] //Failure Scenario public void ValidatingCommentWithPostID(string postID, int id) { test.AssignAuthor("Srinivas"); test.AssignCategory("CommentsParameterization"); RestSharpSupportingClass executingMethod = new RestSharpSupportingClass(); var request = new RestRequest("comments/" + postID, Method.GET); request.AddUrlSegment("postId", postID); var responseDataOfCommentsModel = executingMethod.Execute <Comments>(request, client); Assert.AreEqual(id, responseDataOfCommentsModel.postId, string.Format("ID {0} does not match actually {1}", id, responseDataOfCommentsModel.id)); }
[TestCase("10", "http://placehold.it/600/810b14", "1")] //Expected Failure public void urlValidationOfaPhotoParameterized(string photoId, string url, string albumid) { test.AssignAuthor("Srinivas"); //reporting purpose test.AssignCategory("PhotoUrlVerificationParameterization"); //reporting purpose RestSharpSupportingClass executingMethod = new RestSharpSupportingClass(); var request = new RestRequest("photos/" + albumid); request.AddUrlSegment("id", photoId); // request.AddUrlSegment("id", "1"); var responseDataOfCommentsModel = executingMethod.Execute <Photos>(request, client); Assert.AreEqual(url, responseDataOfCommentsModel.url, string.Format("Expected url {0} is not matching with actual {1}", url, responseDataOfCommentsModel.url)); //Console.WriteLine(responseDataOfCommentsModel.url); }
public void urlValidationOfaPhoto() { test.AssignAuthor("Srinivas"); //reporting purpose test.AssignCategory("PhotoURLValidation"); //reporting purpose RestSharpSupportingClass executingMethod = new RestSharpSupportingClass(); var request = new RestRequest("photos/1"); request.AddUrlSegment("id", "1"); // request.AddUrlSegment("id", "1"); var responseDataOfCommentsModel = executingMethod.Execute <Photos>(request, client); Assert.AreEqual("http://placehold.it/600/92c952", responseDataOfCommentsModel.url, string.Format("Expected url {0} is not matching with actual {1}", "http://placehold.it/600/92c952", responseDataOfCommentsModel.url)); //Console.WriteLine(responseDataOfCommentsModel.url); }
public void verifyPostedResource() { test.AssignCategory("Test Case related to post"); test.AssignAuthor("Srinivas"); RestSharpSupportingClass executingMethod = new RestSharpSupportingClass(); var restRequest = new RestRequest("/posts", Method.POST); restRequest.AddParameter("application/json; charset=utf-8", ParameterType.RequestBody); restRequest.AddParameter("title", "foo"); restRequest.AddParameter("body", "bar"); restRequest.AddParameter("userID", 1); var response = executingMethod.Execute <Posts>(restRequest, client); Assert.AreEqual("bar", response.body, string.Format("Expected body {0} is not matching with actual posted {1}", "bar", response.body)); // Console.WriteLine(response.title); }
public void validatingCommentsOfAParticularID() { test.AssignAuthor("Srinivas"); //reporting purpose test.AssignCategory("Comments"); //reporting purpose RestSharpSupportingClass executingMethod = new RestSharpSupportingClass(); var request = new RestRequest("comments/11", Method.GET); request.AddUrlSegment("id", "11"); var responseDataOfCommentsModel = executingMethod.Execute <Comments>(request, client); //Assert.AreEqual(11, responseDataOfCommentsModel.id, string.Format("ID {0} does not match actually {1}", 11, responseDataOfCommentsModel.id)); Assert.AreEqual(3, responseDataOfCommentsModel.postId); //var assert = responseDataOfCommentsModel.name.Contains("fugit"); //Assert.IsTrue(assert); }