Exemple #1
0
 private static async Task <IGeoNameResponse> CreateFindNearbyToponymQueryResponse(XDocument doc, string itemName)
 {
     if (itemName == "geoname")
     {
         return(await GeoNameResponse.FromXml(doc.Root));
     }
     else
     {
         return(null);
     }
 }
Exemple #2
0
        public async Task Live_extendedFindByNearby_CAN_49285619N_123123184W()
        {
            var client = new HttpClient();

            client.BaseAddress = new Uri("http://api.geonames.org/");

            var response = await client.GetAsync("extendedFindNearby?lat=49.285619&lng=-123.123184&username=obalix&style=full");

            response.IsSuccessStatusCode.ShouldBeTrue();

            if (response.IsSuccessStatusCode)
            {
                var xml = await response.Content.ReadAsStringAsync();

                var doc         = XDocument.Parse(xml);
                var queryResult = await GeoNameResponse.FromXml(doc.Root);

                queryResult.ShouldNotBeNull();
                queryResult.Exception.ShouldBeNull();
                queryResult.Items.ShouldNotBeNull();
                queryResult.Items.Count().ShouldBeGreaterThan(1);
            }
        }
Exemple #3
0
        public async Task Live_findNearbyPlaceName_047300000N_09000000E_full()
        {
            var client = new HttpClient();

            client.BaseAddress = new Uri("http://api.geonames.org/");

            var response = await client.GetAsync("findNearbyPlaceName?lat=47.3&lng=9&username=obalix&style=full");

            response.IsSuccessStatusCode.ShouldBeTrue();

            if (response.IsSuccessStatusCode)
            {
                var xml = await response.Content.ReadAsStringAsync();;

                var doc         = XDocument.Parse(xml);
                var queryResult = await GeoNameResponse.FromXml(doc.Root);

                queryResult.ShouldNotBeNull();
                queryResult.Exception.ShouldBeNull();
                queryResult.Items.ShouldNotBeNull();
                queryResult.Items.Count().ShouldBeGreaterThan(0);
            }
        }
Exemple #4
0
 private static async Task <IGeoNameResponse> CreateFreeSearchResponse(XDocument doc, string itemName)
 {
     return(await GeoNameResponse.FromXml(doc.Root));
 }