public async Task GivenUpdateProductCommandWithInvalidId_ReturnsNotFoundStatusCode() { var invalidCommand = new UpdateNorthwindProductCommand { ProductId = 0, ProductName = "Original Frankfurter grüne Soße", SupplierId = 12, CategoryId = 2, UnitPrice = 15.00m, Discontinued = false }; var content = Utilities.GetRequestContent(invalidCommand); var response = await _client.PutAsync($"/api/products/update", content); Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); }
public async Task GivenUpdateProductCommand_ReturnsSuccessStatusCode() { var command = new UpdateNorthwindProductCommand { ProductId = 77, ProductName = "Original Frankfurter grüne Soße", SupplierId = 12, CategoryId = 2, UnitPrice = 15.00m, Discontinued = false }; var content = Utilities.GetRequestContent(command); var response = await _client.PutAsync($"/api/products/update", content); response.EnsureSuccessStatusCode(); }
public async Task <IActionResult> Update([FromBody] UpdateNorthwindProductCommand command) { await Mediator.Send(command); return(NoContent()); }