public async Task<HttpResponseMessage> GetTripMapPath(TripMapPathRequest request)
 {
     var result = CheckCacheForEntry<IRequest, TripMapPathResponse>(request);
     if (result == null)
     {
         Logger.DebugFormat("Getting {0} from web: ", request.ToString());
         result = await new OpiaNetworkClient().GetTripMapPathAsync(request);
         await StoreResultInCache<IRequest, TripMapPathResponse>(request, result);
     }
     var response = Request.CreateResponse(HttpStatusCode.OK, result);
     return response;
 }
        public async Task GetTripMapPathAsync_MustGetTripMapPathAsync()
        {
            var requestEntity = new TripMapPathRequest
            {
                // TODO these trip ids may not be valid for long 
                // TODO populate properly after a call to GetStopTimeTables or GetRouteTimeTables
                TripId = "14278_3386311_20130808"
            };

            var networkRequestClient = new OpiaNetworkClient();
            TripMapPathResponse result = await networkRequestClient.GetTripMapPathAsync(requestEntity);
            Assert.IsTrue(!String.IsNullOrWhiteSpace(result.Path));
        }
        public void GetTripMapPath_MustGetTripMapPath()
        {
            var requestEntity = new TripMapPathRequest
            {
                // TODO these trip ids may not be valid for long
                // TODO populate properly after a call to GetStopTimeTables or GetRouteTimeTables
                TripId = "14278_3386311_20130808"
            };

            var response = _client.PostAsJsonAsync("network/gettripmappath", requestEntity).Result;
            response.EnsureSuccessStatusCode();
            var result = response.Content.ReadAsAsync<TripMapPathResponse>().Result;

            Assert.IsTrue(!String.IsNullOrWhiteSpace(result.Path));
        }
 public void TripMapPathRequest_ToString_WithMandatoryValuesSet_MustReturnCorrectQueryString()
 {
     var requestEntity = new TripMapPathRequest
     {
         TripId = "14278_3386311_20130808",
     };
     string expected = string.Format("trip-map-path?tripId=14278_3386311_20130808");
     string actual = requestEntity.ToString();
     Assert.AreEqual(expected, actual);
 }
 public void TripMapPathRequest_ToString_WithEmptyTripIds_MustThrowArgumentException()
 {
     var requestEntity = new TripMapPathRequest();
     string expected = requestEntity.ToString();
 }