public void LocationsRequest_ToString_WithMandatoryValuesSet_MustReturnCorrectQueryString() { var requestEntity = new LocationsRequest() { LocationIds = new List<string>() { "LM:Parks & Reserves:Anzac Square", "LM:Parks & Reserves:Botanic Gardens" } }; string expected = string.Format("locations?ids=LM%3AParks%20%26%20Reserves%3AAnzac%20Square%2CLM%3AParks%20%26%20Reserves%3ABotanic%20Gardens"); string actual = requestEntity.ToString(); Assert.AreEqual(expected, actual); }
public void LocationsRequest_WithNoLocationIds_MustThrowArgumentException() { var requestEntity = new LocationsRequest(); string expected = requestEntity.ToString(); }
public async Task<HttpResponseMessage> GetLocationsByIds(LocationsRequest request) { var result = CheckCacheForEntry<IRequest, LocationsResponse>(request); if (result == null) { Logger.DebugFormat("Getting {0} from web: ", request.ToString()); result = await new OpiaLocationClient().GetLocationsByIdsAsync(request); await StoreResultInCache<IRequest, LocationsResponse>(request, result); } var response = Request.CreateResponse(HttpStatusCode.OK, result); return response; }