protected async Task TestPut(ITestClient client, string apiUrl, string[] expectedFields, Dictionary <string, object> updates, string identifierName = "id") { var existing = await GetExistingObject(client, apiUrl, expectedFields); Assert.IsNotNull(existing); //ensure new props foreach (var key in updates.Keys.ToList()) { Assert.IsTrue(existing.ContainsKey(key), $"{key} not found in json"); EnsureJsonTypeMatchesObjectType(existing[key].Type, updates[key]); //have to check for null because existing[key] can be null if (existing[key] == null && updates[key] == null || existing[key].ToString() == updates[key].ToString()) { Assert.Fail($"property {key} is already equal; hence this test does not fully test the intended behaviour. aborting"); } } //put changes await client.PutAsync(apiUrl + "/" + existing[identifierName], updates); //check that it has been preserved await EnsureObjectExists(client, apiUrl, expectedFields, identifierName, (int)existing[identifierName], updates); }