Ejemplo n.º 1
0
        public async Task VerifyStreetServiceLatLngOnlyAsync()
        {
            Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY);

            WaitForApiLimit();

            var result = await gis.findStreetAsync(ALBANY_AIRPORT_LAT, ALBANY_AIRPORT_LNG);

            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(167344877, firstResult.id);
            Assert.AreEqual(-73.80948451774645, firstResult.longitude);
            Assert.AreEqual(42.74511469046002, firstResult.latitude);
            Assert.AreEqual("Airport Terminal Road", firstResult.name);
            Assert.AreEqual("UNCLASSIFIED", firstResult.streetType);
            Assert.AreEqual("US", firstResult.countryCode);
            Assert.AreEqual(0.217368757236126, firstResult.distance);
            Assert.AreEqual(5583598, firstResult.openStreetMapId);
            Assert.AreEqual(false, firstResult.oneWay);
            Assert.AreEqual(738.207938454055, firstResult.length);
            Assert.AreEqual("Colonie", firstResult.isIn);
            Assert.AreEqual("Shakers", firstResult.isInPlace);
            Assert.AreEqual("Albany County", firstResult.isInAdm);

            Console.WriteLine(result.ToString());
        }
Ejemplo n.º 2
0
        public void VerifyStreetServiceInvalidLngLowAsync()
        {
            Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY);

            Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.findStreetAsync(0, -200), "Longitude must be between -180 and 180");
        }
Ejemplo n.º 3
0
        public void VerifyStreetAddressInvalidRadiusAsync()
        {
            Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY);

            Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.findStreetAsync(ALBANY_AIRPORT_LAT, ALBANY_AIRPORT_LNG, -100), "Radius must be greater than 0");
        }
Ejemplo n.º 4
0
        public void VerifyStreetServiceInvalidLatLowAsync()
        {
            Gisgraphy gis = new Gisgraphy(SERVER_URL, API_KEY);

            Assert.ThrowsAsync <ArgumentOutOfRangeException>(async() => await gis.findStreetAsync(-100, 0), "Latitude must be between -90 an 90");
        }