public async Task Put_WithMissingRevenue_ReturnsBadRequest() { var customer = new TestCustomerCreateModel { State = "FL", Business = "Programmer" }; var serializeUpdatedCustomer = JsonConvert.SerializeObject(customer); var stringContent = new StringContent(serializeUpdatedCustomer, Encoding.UTF8, "application/json"); var response = await _client.PutAsync("http://localhost/api/quotes/2", stringContent); Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); }
public async Task Put_InvalidId_ReturnsNotFound() { var customer = new TestCustomerCreateModel { Revenue = 222222, State = "TX", Business = "Plumber" }; var serializeUpdatedCustomer = JsonConvert.SerializeObject(customer); var stringContent = new StringContent(serializeUpdatedCustomer, Encoding.UTF8, "application/json"); var response = await _client.PutAsync("http://localhost/api/quotes/99", stringContent); Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); }
public async Task Post_WithMissingState_ReturnsBadRequest() { var invalidCustomer = new TestCustomerCreateModel { Revenue = 15000, Business = "Plumber" }; var serializeCustomer = JsonConvert.SerializeObject(invalidCustomer); var content = new StringContent(serializeCustomer); content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var response = await _client.PostAsync("", content); Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); }
public async Task Post_WithLargestAllowedRevenue_ReturnsCreated() { var customer = new TestCustomerCreateModel { Revenue = 8888888888888888.88m, State = "FL", Business = "Plumber" }; var serializeCustomer = JsonConvert.SerializeObject(customer); var content = new StringContent(serializeCustomer); content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var response = await _client.PostAsync("", content); Assert.Equal(HttpStatusCode.Created, response.StatusCode); }