public async Task put_valid_player_is_updated(string url) { var generated = DatabaseSeed.GenerateRandomPlayer(); var postContent = new StringContent(JsonConvert.SerializeObject(generated), System.Text.Encoding.UTF8, "application/json"); var postResponse = await client.PostAsync(url, postContent); postResponse.EnsureSuccessStatusCode(); var playerContent = await postResponse.Content.ReadAsStringAsync(); var player = JsonConvert.DeserializeObject <Player>(playerContent); player.LastName = DatabaseSeed.GetRandomLastName(); player.Age = DatabaseSeed.GetRandomAge(); var putContent = new StringContent(JsonConvert.SerializeObject(player), System.Text.Encoding.UTF8, "application/json"); var response = await client.PutAsync($"{url}/{player.PlayerId}", putContent); var getResponse = await client.GetAsync($"{url}/{player.PlayerId}"); getResponse.EnsureSuccessStatusCode(); var getContent = await getResponse.Content.ReadAsStringAsync(); var resultPlayer = JsonConvert.DeserializeObject <Player>(getContent); Assert.Equal(player.LastName, resultPlayer.LastName); Assert.Equal(player.Age, resultPlayer.Age); }