Example #1
0
 public async Task WhenUpdateCompleteFlightButWrongValuesTheGetArgumentNullException()
 {
     var flightDto = new UpdateFlightDto {
         DepartureAirportId = 1, DestinationAirportId = 3, AircraftId = 1
     };
     var result = await _business.UpdateAsync(flightDto);
 }
Example #2
0
        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);
        }
Example #3
0
 public async void Put([FromServices] IFlightBusiness business, int id, [FromBody] UpdateFlightDto flight)
 {
     try
     {
         await business.UpdateAsync(flight);
     }
     catch (Exception ex)
     {
         _logger.LogError(ex.Message);
     }
 }
Example #4
0
        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));
        }