public async Task<HttpResponseMessage> GetPlanUrl(PlanUrlRequest request)
 {
     var result = CheckCacheForEntry<IRequest, PlanUrlResponse>(request);
     if (result == null)
     {
         Logger.DebugFormat("Getting {0} from web: ", request.ToString());
         result = await new OpiaTravelClient().GetPlanUrlAsync(request);
         await StoreResultInCache<IRequest, PlanUrlResponse>(request, result);
     }
     var response = Request.CreateResponse(HttpStatusCode.OK, result);
     return response;
 }
 public void PlanUrlRequest_ToString_WithNoVehicleTypes_MustThrowArgumentException()
 {
     var requestEntity = new PlanUrlRequest()
     {
         FromLocationId = "SI:000026",
         ToLocationId = "AD:80 Mary St, City",
         VehicleTypes = new List<VehicleType>(),
         DateAndTime = DateTime.Now.AddDays(1),
         FareTypes = new List<FareType>() { FareType.Standard, FareType.Prepaid, FareType.Free },
         MaximumWalkingDistanceM = 120,
         ServiceTypes = new List<ServiceType>() { ServiceType.Regular, ServiceType.Express },
         TimeModeType = TimeModeType.ArriveBefore,
         WalkingSpeedType = WalkingSpeedType.Normal,
     };
     string expected = requestEntity.ToString();
 }
 public void PlanUrlRequest_ToString_WithMandatoryValuesSet_MustReturnCorrectQueryString()
 {
     var requestEntity = new PlanUrlRequest()
     {
         FromLocationId = "SI:000026",
         ToLocationId = "AD:80 Mary St, City",
         VehicleTypes = new List<VehicleType>() { VehicleType.Bus, VehicleType.Train },
         DateAndTime = DateTime.Now.AddDays(1),
         MaximumWalkingDistanceM = 500,
         ServiceTypes = new List<ServiceType>() { ServiceType.Regular, ServiceType.Express },
         FareTypes = new List<FareType>() { FareType.Standard, FareType.Prepaid, FareType.Free },
         TimeModeType = TimeModeType.ArriveBefore,
         WalkingSpeedType = WalkingSpeedType.Normal,
     };
     string expected = string.Format("plan-url/SI%3A000026/AD%3A80%20Mary%20St%2C%20City?timeMode=1&at={0}&vehicleTypes=2,8&walkSpeed=1&maximumWalkingDistanceM=500&serviceTypes=1,2&fareTypes=2,4,1", Uri.EscapeDataString(DateTime.Now.AddDays(1).ToString("s")));
     string actual = requestEntity.ToString();
     Assert.AreEqual(expected, actual);
 }