Esempio n. 1
0
        public async Task TestThatPostUpdateWithPartialValidJson()
        {
            //send request to the server to /Update/id/1

            var         obj     = new { Specialization = "TestSpecialization" };
            HttpContent content = new StringContent(JsonConvert.SerializeObject(obj));

            content.Headers.ContentType.MediaType = MediaTypeNames.Application.Json;
            HttpResponseMessage response = await _client.PostAsync(urlupdateid, content);

            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode, "Sorry, the response status is not OK");
            //debug
            var message = await response.Content.ReadAsStringAsync();

            //verify the patched XML with previous XML state
            var xdoc1 = XDocument.Load("./Data/Data[1].xml");

            var changeddict = Comparisons.CompareXMLsForChanges(xdoc, xdoc1, "1");


            Assert.IsTrue(changeddict.ContainsKey("Specialization"), "No changed data");
        }