public async Task WhenUpdateCompleteFlightButWrongValuesTheGetArgumentNullException() { var flightDto = new UpdateFlightDto { DepartureAirportId = 1, DestinationAirportId = 3, AircraftId = 1 }; var result = await _business.UpdateAsync(flightDto); }
public async Task WhenUpdateCompleteFlightTheReturnsTrue() { var flightDto = new UpdateFlightDto { DepartureAirportId = 1, DestinationAirportId = 2, AircraftId = 1 }; var result = await _business.UpdateAsync(flightDto); result.Should().Be(true); _flightServiceMock.Verify(f => f.UpdateAsync(flightDto), Times.Once); }
public async void Put([FromServices] IFlightBusiness business, int id, [FromBody] UpdateFlightDto flight) { try { await business.UpdateAsync(flight); } catch (Exception ex) { _logger.LogError(ex.Message); } }
public async Task <bool> UpdateAsync(UpdateFlightDto flight) { if (flight == null) { throw new ArgumentNullException(nameof(UpdateAsync)); } try { flight = (UpdateFlightDto) await CompleteFlight(flight); } catch (ArgumentNullException) { throw; } return(await _flightService.UpdateAsync(flight)); }