public void VerifySingleUserDetailsTest() { //Arrange User expectedUserData = new User() { Id = 2, Email = "*****@*****.**", First_name = "Janet", Last_name = "Weaver", Avatar = "https://s3.amazonaws.com/uifaces/faces/twitter/josephstein/128.jpg" }; Ad expectedAdData = new Ad() { Company = "StatusCode Weekly", Url = "http://statuscode.org/", Text = "A weekly newsletter focusing on software development, infrastructure, the server, performance, and the stack end of things." }; string url = "https://reqres.in/api/users/2"; RestAPIHelpers apiHelper = new RestAPIHelpers(); RestClient client = new RestClient(url); RestRequest request = apiHelper.CreateGetRequest(); //Act IRestResponse response = client.Execute(request); var result = JsonConvert.DeserializeObject <SingleUserJSonModel>(response.Content.ToString()); // Assert Assert.IsTrue(DataHelper.CompareSingleUserData(expectedUserData, result.User) && DataHelper.CompareUserAdData(expectedAdData, result.Ad), "Response Received is wrong"); }
public void WhenISubmitGETUserDetailsRequest() { RestClient client = new RestClient(getDetailsUrl); RestAPIHelpers apiHelper = new RestAPIHelpers(); RestRequest request = apiHelper.CreateGetRequest(); response = client.Execute(request); }
public void WhenISubmitTheGETRequest() { RestClient client = new RestClient(invalidUrl); RestAPIHelpers apiHelper = new RestAPIHelpers(); RestRequest request = apiHelper.CreateGetRequest(); response = client.Execute(request); }
public void VerifyUserNotFoundTest() { //Arrange string url = "https://reqres.in/api/users/23"; RestAPIHelpers apiHelper = new RestAPIHelpers(); RestClient client = new RestClient(url); RestRequest request = apiHelper.CreateGetRequest(); //Act IRestResponse response = client.Execute(request); //Assert Assert.AreEqual(response.StatusCode, HttpStatusCode.NotFound); }
public void VerifyUserListDetailsTest() { //Arrange List <User> expectedUsersData = new List <User>() { new User() { Id = 7, Email = "*****@*****.**", First_name = "Michael", Last_name = "Lawson", Avatar = "https://s3.amazonaws.com/uifaces/faces/twitter/follettkyle/128.jpg" }, new User() { Id = 8, Email = "*****@*****.**", First_name = "Lindsay", Last_name = "Ferguson", Avatar = "https://s3.amazonaws.com/uifaces/faces/twitter/araa3185/128.jpg" }, new User() { Id = 9, Email = "*****@*****.**", First_name = "Tobias", Last_name = "Funke", Avatar = "https://s3.amazonaws.com/uifaces/faces/twitter/vivekprvr/128.jpg" }, new User() { Id = 10, Email = "*****@*****.**", First_name = "Byron", Last_name = "Fields", Avatar = "https://s3.amazonaws.com/uifaces/faces/twitter/russoedu/128.jpg" }, new User() { Id = 11, Email = "*****@*****.**", First_name = "George", Last_name = "Edwards", Avatar = "https://s3.amazonaws.com/uifaces/faces/twitter/mrmoiree/128.jpg" }, new User() { Id = 12, Email = "*****@*****.**", First_name = "Rachel", Last_name = "Howell", Avatar = "https://s3.amazonaws.com/uifaces/faces/twitter/hebertialmeida/128.jpg" } }; Ad expectedAdData = new Ad() { Company = "StatusCode Weekly", Url = "http://statuscode.org/", Text = "A weekly newsletter focusing on software development, infrastructure, the server, performance, and the stack end of things." }; string url = "https://reqres.in/api/users?page=2"; RestAPIHelpers apiHelper = new RestAPIHelpers(); RestClient client = new RestClient(url); RestRequest request = apiHelper.CreateGetRequest(); //Act IRestResponse response = client.Execute(request); var result = JsonConvert.DeserializeObject <UserListJSonModel>(response.Content.ToString()); // assert Assert.IsTrue(DataHelper.CompareMultipleUserData(expectedUsersData, result.Users) && DataHelper.CompareUserAdData(expectedAdData, result.Ad), "Response Received is wrong"); }