public async Task <GetReservationsResponse> Handle(GetReservationsRequest message) { var validationResult = _validator.Validate(message); if (!validationResult.IsValid()) { throw new InvalidRequestException(validationResult.ValidationDictionary); } long accountId = _hashingService.DecodeValue(message.HashedAccountId); _logger.Info($"Getting reservations for hashed account id {message.HashedAccountId}"); try { return(new GetReservationsResponse { Reservations = await _service.Get(accountId) }); } catch (Exception ex) { _logger.Error(ex, $"Failed to get Reservations for {message.HashedAccountId}"); return(new GetReservationsResponse { HasFailed = true }); } }
public async Task ThenTheReservationsAreReturnedFromTheApi() { // arrange // act var result = await _sut.Get(_accountId); // assert result.Count().Should().Be(1); result.First().AccountId.Should().Be(_accountId); }
public async Task <IEnumerable <Reservation> > Get(long accountId) { try { return(await _pollyPolicy.ExecuteAsync(() => _service.Get(accountId))); } catch (TimeoutRejectedException ex) { throw new ServiceTimeoutException("Call to Reservation Service timed out", ex); } }
public IEnumerable <ReservationDetail> Get(DateTime day, int assetNumber) { return(_service.Get(day, assetNumber)); }