public void RouteTimeTablesRequest_ToString_WithEmptyRoutes_MustThrowArgumentException()
 {
     var requestEntity = new RouteTimeTablesRequest
     {
         FilterToStartEndStops = true,
         Date = DateTime.Now.AddDays(1),
         VehicleType = VehicleType.Bus,
     };
     string expected = requestEntity.ToString();
 }
 public void RouteTimeTablesRequest_ToString_WithDateNotSet_MustThrowArgumentException()
 {
     var requestEntity = new RouteTimeTablesRequest
     {
         RouteCodes = new List<string>() { "P137" },
         FilterToStartEndStops = true,
         VehicleType = VehicleType.Bus,
     };
     string expected = requestEntity.ToString();
 }
 public async Task<HttpResponseMessage> GetRouteTimeTables(RouteTimeTablesRequest request)
 {
     var result = CheckCacheForEntry<IRequest, RouteTimeTablesResponse>(request);
     if (result == null)
     {
         Logger.DebugFormat("Getting {0} from web: ", request.ToString());
         result = await new OpiaNetworkClient().GetRouteTimeTablesAsync(request);
         await StoreResultInCache<IRequest, RouteTimeTablesResponse>(request, result);
     }
     var response = Request.CreateResponse(HttpStatusCode.OK, result);
     return response;
 }
        public void RouteTimeTablesRequest_ToString_WithMandatoryValuesSet_MustReturnCorrectQueryString()
        {
            var requestEntity = new RouteTimeTablesRequest
                        {
                            RouteCodes = new List<string>(){"P137", "130"},
                            FilterToStartEndStops = true,
                            VehicleType = VehicleType.Bus,
                            Date = DateTime.Now.AddDays(1),
                        };

            // route-timetables?routeCodes=P137,130&date=2013-08-07&vehicleType=2&filterToStartEndStops=true
            string expected = string.Format("route-timetables?routeCodes=P137,130&date={0}&vehicleType=2&filterToStartEndStops=true", DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"));

            string actual = requestEntity.ToString();
            Assert.AreEqual(expected, actual);
        }