Esempio n. 1
0
        public void UpdateSalaryIntoJSONServer()
        {
            RestRequest request = new RestRequest("/employees/11", Method.PUT);

            JObject jObject = new JObject();

            jObject.Add("name", "Tanmay");
            jObject.Add("salary", "30000");

            request.AddParameter("application/json", jObject, ParameterType.RequestBody);

            IRestResponse response = restClient.Execute(request);

            Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);

            EmployeePayroll employee = JsonConvert.DeserializeObject <EmployeePayroll>(response.Content);

            Assert.AreEqual("Tanmay", employee.name);

            Assert.AreEqual("30000", employee.salary);

            Console.WriteLine(response.Content);
        }