Ejemplo n.º 1
0
        public void WhenIPUTRequestToUpdateAUserDetail()
        {
            RestAPIHelpers apiHelper = new RestAPIHelpers();
            RestClient     client    = new RestClient(url);
            RestRequest    request   = apiHelper.CreatePutRequest(updatedUserData);

            response = client.Execute(request);
        }
        public void VerifyUpdateUserTest()
        {
            //Arrange
            UserRequestJsonModel updatedUserData = new UserRequestJsonModel()
            {
                name = "morpheus",
                job  = "tester"
            };

            var url = "https://reqres.in/api/users/2";

            RestAPIHelpers apiHelper = new RestAPIHelpers();
            RestClient     client    = new RestClient(url);
            RestRequest    request   = apiHelper.CreatePutRequest(updatedUserData);

            //Act
            IRestResponse response = client.Execute(request);
            var           result   = JsonConvert.DeserializeObject <UpdateResponseJsonModel>(response.Content.ToString());

            //Assert
            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode, "Update user Failed");
            Assert.IsTrue(((result.name == updatedUserData.name) && (result.job == updatedUserData.job)), "User not updated successfully");
        }