/// <summary> /// Integration test for SchoolbushistoriesGet /// </summary> public async void TestSchoolBusHistory() { var request = new HttpRequestMessage(HttpMethod.Post, "/api/schoolbushistories"); SchoolBusHistory schoolBusHistory = new SchoolBusHistory(); var jsonString = schoolBusHistory.ToJson(); request.Content = new StringContent(jsonString, Encoding.UTF8, "application/json"); var response = await _client.SendAsync(request); response.EnsureSuccessStatusCode(); // parse as JSON. jsonString = await response.Content.ReadAsStringAsync(); schoolBusHistory = JsonConvert.DeserializeObject <SchoolBusHistory>(jsonString); // get the id var id = schoolBusHistory.Id; request = new HttpRequestMessage(HttpMethod.Put, "/api/schoolbushistories/" + id); request.Content = new StringContent(schoolBusHistory.ToJson(), Encoding.UTF8, "application/json"); response = await _client.SendAsync(request); response.EnsureSuccessStatusCode(); // do a get. request = new HttpRequestMessage(HttpMethod.Get, "/api/schoolbushistories/" + id); response = await _client.SendAsync(request); response.EnsureSuccessStatusCode(); // parse as JSON. jsonString = await response.Content.ReadAsStringAsync(); schoolBusHistory = JsonConvert.DeserializeObject <SchoolBusHistory>(jsonString); // do a delete. request = new HttpRequestMessage(HttpMethod.Post, "/api/schoolbushistories/" + id + "/delete"); response = await _client.SendAsync(request); response.EnsureSuccessStatusCode(); // should get a 404 if we try a get now. request = new HttpRequestMessage(HttpMethod.Get, "/api/schoolbushistories/" + id); response = await _client.SendAsync(request); Assert.Equal(response.StatusCode, HttpStatusCode.NotFound); }