public async Task <ActionResult> DeletePhoneBook(long id, DeletePhoneBook command) { if (id != command.Id) { return(BadRequest()); } await Mediator.Send(command); return(NoContent()); }
public async Task DeletePhoneBookMustSuccess() { var command = new DeletePhoneBook { Id = 1 }; var result = _controller.Delete(command); await _dispatcher.Received().SendAsync(Arg.Is <DeletePhoneBook>(x => x.Id == 1)); Assert.IsType <OkResult>(result.Result); }
public async Task <ActionResult> Delete([FromQuery] DeletePhoneBook command) { await _dispatcher.SendAsync(command); return(Ok()); }