public async Task GivenUpdateCustomerCommandWithInvalidId_ReturnsNotFoundStatusCode() { var invalidCommand = new UpdateNorthwindCustomerCommand { Id = "AAAAA", Address = "Obere Str. 57", City = "Berlin", CompanyName = "Alfreds Futterkiste", ContactName = "Maria Anders", ContactTitle = "Sales Representative", Country = "Germany", Fax = "030-0076545", Phone = "030-0074321", PostalCode = "12209" }; var content = Utilities.GetRequestContent(invalidCommand); var response = await _client.PutAsync($"/api/customers/update/{invalidCommand.Id}", content); Assert.Equal(HttpStatusCode.NotFound, response.StatusCode); }
public async Task GivenUpdateCustomerCommand_ReturnsSuccessStatusCode() { var command = new UpdateNorthwindCustomerCommand { Id = "ALFKI", Address = "Obere Str. 57", City = "Berlin", CompanyName = "Alfreds Futterkiste", ContactName = "Maria Anders", ContactTitle = "Sales Representative", Country = "Germany", Fax = "030-0076545", Phone = "030-0074321", PostalCode = "12209" }; var content = Utilities.GetRequestContent(command); var response = await _client.PutAsync($"/api/customers/update/{command.Id}", content); response.EnsureSuccessStatusCode(); }
public async Task <IActionResult> Update([FromBody] UpdateNorthwindCustomerCommand command) { await Mediator.Send(command); return(NoContent()); }