Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            Venue venue = new Venue();

            List <Venue> venuesList = venue.GetList();

            foreach (Venue venueItem in venuesList)
            {
                if (venueItem.Latitude == 0 && venueItem.Longitude == 0)
                {
                    GoogleMapsConnector gmConn = new GoogleMapsConnector();
                    //Location location = gmConn.GetLocation(venueItem.Name + ',' + venueItem.Address1 + ',' + venueItem.Country.Name);
                    Location location = gmConn.GetLocation(venueItem.Name + ',' + venueItem.Country.Name);

                    if (location != null)
                    {
                        venueItem.Latitude  = location.Latitude;
                        venueItem.Longitude = location.Longitude;
                        venueItem.City      = (venueItem.City == null ? location.City : venueItem.City);

                        if (venueItem.Country.Name == location.Country)
                        {
                            venueItem.Commit();
                        }
                    }
                }
            }
        }
        public async Task Should_CallGoogleMapsApiOKAsync()
        {
            var connector = new GoogleMapsConnector(_configuration);

            var location = await connector.GetLocationAsync(AddressFake.GetAddress());

            Assert.NotNull(location);
            Assert.True(location.Latitude != 0);
            Assert.True(location.Longitude != 0);
        }