Example #1
0
        /// <summary>
        /// Might enable this, this feature is pretty bad
        /// </summary>
        /// <returns></returns>
        public async Task VerifyAddressParserAddressAndCountryAsync()
        {
            Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY);

            WaitForApiLimit();

            //Check Albany International Airport
            var result = await gis.parseAddressAsync(ALBANY_AIRPORT_POSTAL_ADDRESS, "US");

            var firstResult = result.results.FirstOrDefault();

            lastApiCall = DateTime.Now;

            Assert.Greater(result.resultsFound, 0);
            Assert.AreEqual(result.executionTime, result.executionTimeSpan.TotalSeconds);
            Assert.AreEqual(result.resultsFound, result.results.Count());
            Assert.AreEqual(firstResult.geocodingLevel, "CITY");
            Assert.AreEqual(firstResult.city, "Terminal");
            Assert.AreEqual(firstResult.countryCode, "US");
            Assert.AreEqual(firstResult.confidence, "LOW");

            Console.WriteLine(result.ToString());
        }
Example #2
0
        public void VerifyAddressParserIncorrectCountryCodeFormatAsync()
        {
            Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY);

            Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.parseAddressAsync(ALBANY_AIRPORT_ADDRESS, "United States"), "Country needs to be the ISO 3166 Alpha 2 code");
        }
Example #3
0
        public void VerifyAddressParserNoAddressAsync()
        {
            Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY);

            Assert.ThrowsAsync <ArgumentNullException>(async() => await gis.parseAddressAsync(null), "Address is a required parameter");
        }