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);
            }
        }
Exemple #2
0
        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);
            }
        }