protected override async Task <IOperationResponse <GetDeliveryCostHandlerResponse> > HandleAsync(GetDeliveryCostHandlerRequest request) { var deliveryRoutes = await _deliveryRouteReadOnlyRepository.GetDictionaryAsync(); if (deliveryRoutes == null || !deliveryRoutes.Any()) { throw new DataAccessNotFoundException(ResponseMessages.Route.DoesNotExist); } var routes = BuildRoutes(request.Route); var deliveryCost = CalculateDeliveryCost(routes, deliveryRoutes); return(Success(new GetDeliveryCostHandlerResponse(deliveryCost))); }
private void GivenDeliveryRouteData() { _deliveryRouteReadOnlyRepository .GetDictionaryAsync() .Returns(_deliveryRoutes); }