Пример #1
0
        public void PlacePathTest(double latitude, double longitude, string placeName)
        {
            IReverseGeocoder geocoder = new ReverseGeocoder(CitiesDbPath);
            var place = geocoder.GetNearestPlace(latitude, longitude);

            Assert.NotNull(place);
            Assert.AreEqual(placeName, place.Name);
        }
Пример #2
0
        public void PlaceStreamTest(double latitude, double longitude, string placeName)
        {
            using (var fileStream = File.OpenRead(CitiesDbPath))
            {
                IReverseGeocoder geocoder = new ReverseGeocoder(fileStream);
                var place = geocoder.GetNearestPlace(latitude, longitude);

                Assert.NotNull(place);
                Assert.AreEqual(placeName, place.Name);
            }
        }
Пример #3
0
        public void CountryDbTest(double latitude, double longitude, string placeName, string countryName)
        {
            var geoDb = new GeoDb(CitiesDbPath, CountresDbPath);

            IReverseGeocoder geocoder = new ReverseGeocoder(geoDb);
            var place = geocoder.GetNearestPlace(latitude, longitude);

            Assert.NotNull(place);
            Assert.AreEqual(placeName, place.Name);
            Assert.NotNull(place.CountryInfo);
            Assert.AreEqual(countryName, place.CountryInfo.Country);
        }
Пример #4
0
        public void CountryStreamTest(double latitude, double longitude, string placeName, string countryName)
        {
            using (var fileStreamCities = File.OpenRead(CitiesDbPath))
                using (var fileStreamCountries = File.OpenRead(CountresDbPath))
                {
                    IReverseGeocoder geocoder = new ReverseGeocoder(fileStreamCities, fileStreamCountries);
                    var place = geocoder.GetNearestPlace(latitude, longitude);

                    Assert.NotNull(place);
                    Assert.AreEqual(placeName, place.Name);
                    Assert.NotNull(place.CountryInfo);
                    Assert.AreEqual(countryName, place.CountryInfo.Country);
                }
        }
Пример #5
0
        public void OddCoordinatesTest(double latitude, double longitude)
        {
            IReverseGeocoder geocoder = new ReverseGeocoder(CitiesDbPath);

            Assert.DoesNotThrow(() => geocoder.GetNearestPlace(latitude, longitude));
        }