public async Task Should_delete_a_chassis() { using (var client = new TestClientProvider().Client) { var response = await client.DeleteAsync("/api/chassis/" + standardChassis.Id); Assert.Equal(HttpStatusCode.OK, response.StatusCode); } }
public async Task Should_get_vehicle_by_chassis_id() { using (var client = new TestClientProvider().Client) { var response = await client.GetAsync("/api/vehicles/chassis/ " + standardVehicle.ChassisId); response.EnsureSuccessStatusCode(); Assert.Equal(HttpStatusCode.OK, response.StatusCode); } }
public async Task Should_error_same_vehicle() { using (var client = new TestClientProvider().Client) { var response = await client.PostAsync("/api/vehicles", new StringContent( JsonConvert.SerializeObject(standardVehicle) , Encoding.UTF8, "application/json")); Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); } }
public async Task Should_get_all_vehicles() { using (var client = new TestClientProvider().Client) { var response = await client.GetAsync("/api/vehicles"); response.EnsureSuccessStatusCode(); Assert.Equal(HttpStatusCode.OK, response.StatusCode); } }
public async Task Should_return_same_chassis() { using (var client = new TestClientProvider().Client) { var response = await client.PostAsync("/api/chassis", new StringContent( JsonConvert.SerializeObject(standardChassis) , Encoding.UTF8, "application/json")); var returnedChassis = await response.Content.ReadAsStringAsync(); Assert.NotNull(returnedChassis); } }
public async Task Should_save_a_vehicle() { using (var client = new TestClientProvider().Client) { var response = await client.PostAsync("/api/vehicles", new StringContent( JsonConvert.SerializeObject(standardVehicle) , Encoding.UTF8, "application/json")); string responseVehicle = await response.Content.ReadAsStringAsync(); standardVehicle = JsonConvert.DeserializeObject <Vehicle>(responseVehicle); Assert.Equal(HttpStatusCode.Created, response.StatusCode); } }