Esempio n. 1
0
        public PlaceDto(OsmPlace osmPlace)
        {
            Id = osmPlace.PlaceId;
            Name = osmPlace.Namedetails?.Name;
            DisplayName = osmPlace.DisplayName;
            Coordinate = osmPlace.Lat.HasValue && osmPlace.Lon.HasValue
                ? new CoordinateDto(osmPlace.Lat, osmPlace.Lon)
                : null;

            if (osmPlace.Address != null)
            {
                Address = new AddressDto(osmPlace.Address);
            }
        }
        public void SearchOsmPlacesTest()
        {
            string query = "bakery in berlin wedding";
            int    osmPlaceIdExpected = 1286434;

            IList <OsmPlace> osmPlaces = nominatimOsmApi.SearchOsmPlaces(query, 10);

            Assert.IsNotNull(osmPlaces);
            CollectionAssert.Contains(osmPlaces.Select(s => s.PlaceId), osmPlaceIdExpected);

            OsmPlace osmPlace = osmPlaces.FirstOrDefault(s => s.PlaceId == osmPlaceIdExpected);

            Assert.IsNotNull(osmPlace);
            Assert.AreEqual("Kamps", osmPlace.Namedetails.Name);
            Assert.AreEqual("Berlin", osmPlace.Address.City);
            Assert.AreEqual("Müllerstraße", osmPlace.Address.Road);
        }