Exemplo n.º 1
0
        public void CantGeoCode1BogusAddress()
        {
            _apiAgent = new BulkApiAgent();
            var testAddressList = new List <Address>
            {
                AddressParser.ParseAddressFromCsv("1,9999 Massachusetts Avenue,Cramburdge,MA,02139")
            };

            var result = _apiAgent.BulkGeocode(testAddressList);

            Assert.True(result[0].Match == false);
        }
Exemplo n.º 2
0
        public void CanGeoCode1RealAddress()
        {
            _apiAgent = new BulkApiAgent();
            var testAddressList = new List <Address>
            {
                AddressParser.ParseAddressFromCsv("1,667 Massachusetts Avenue,Cambridge,MA,02139")
            };

            var result = _apiAgent.BulkGeocode(testAddressList);

            Assert.True(result[0].Latitude == 42.365723);
        }
Exemplo n.º 3
0
        public void CanGeoCode5RealAddresses()
        {
            _apiAgent = new BulkApiAgent();
            var testAddressList = new List <Address>
            {
                AddressParser.ParseAddressFromCsv("1,667 Massachusetts Avenue,Cambridge,MA,02139"),
                AddressParser.ParseAddressFromCsv("2,30 Tyler Street,Boston,MA,02111"),
                AddressParser.ParseAddressFromCsv("3,216 Norfolk Street,Cambridge,MA,02139"),
                AddressParser.ParseAddressFromCsv("4,688 Concord Avenue,Belmont,MA,02478"),
                AddressParser.ParseAddressFromCsv("5,244 Elm St,Cambridge,MA,02139")
            };

            var result         = _apiAgent.BulkGeocode(testAddressList);
            var compareAddress = result.First(addressResponse => addressResponse.Id == 1);

            Assert.True(compareAddress.Latitude == 42.365723);
        }
Exemplo n.º 4
0
        public void CanBuildAddressFromCsv()
        {
            var correctAddress = new Address
            {
                Id     = 1,
                Street = "667 Massachusetts Avenue",
                City   = "Cambridge",
                State  = "MA",
                Zip    = "02139"
            };

            var address = AddressParser.ParseAddressFromCsv
                          (
                "1,667 Massachusetts Avenue,Cambridge,MA,02139"
                          );

            Assert.True(address.Equals(correctAddress));
        }