public void DeleteAttribute() { AFWebAttribute test = new AFWebAttribute { Name = "ToDelete" }; string s = JsonConvert.SerializeObject(test); HttpContent content = new StringContent(s, Encoding.UTF8, "application/json"); HttpResponseMessage response = httpClient.PostAsync($"{Resource.Base}/elements/{Resource.WebIdTestElement}/attributes", content).Result; string webId = response.Headers.Location.ToString().Split('/').Last(); Assert.True(String.Equals("Created", response.StatusCode.ToString(), StringComparison.InvariantCultureIgnoreCase)); api.DeleteAttribute(webId); HttpResponseMessage expectedResponse = httpClient.GetAsync($"{Resource.Base}/attributes/{webId}").Result; Assert.True(String.Equals("NotFound", expectedResponse.StatusCode.ToString(), StringComparison.InvariantCultureIgnoreCase)); }
public void UpdateAttribute() { AFWebAttribute test = new AFWebAttribute { Description = "hello" }; api.UpdateAttribute(Resource.WebIdPatchAttribute, test); string testResponse = JsonConvert.SerializeObject(test); string expectedResponse = httpClient.GetAsync($"{Resource.Base}/attributes/{Resource.WebIdPatchAttribute}") .Result.Content .ReadAsStringAsync().Result; AFWebAttribute expected = JsonConvert.DeserializeObject<AFWebAttribute>(expectedResponse); Assert.True(String.Equals(test.Description, expected.Description, StringComparison.InvariantCultureIgnoreCase)); test = new AFWebAttribute { Description = "" }; api.UpdateAttribute(Resource.WebIdPatchAttribute, test); }