public void TestGetState()
        {
            var addrData = new AddressData();

            UsCityStateZip.GetState("OKLAHOMA CITY, OK", addrData);
            Assert.IsNotNull(addrData.RegionAbbrev);
            Assert.AreEqual("OK", addrData.RegionAbbrev);
            UsCityStateZip.GetState("Washington DC 20006", addrData);
            Assert.IsNotNull(addrData.RegionAbbrev);
            Assert.AreEqual("DC", addrData.RegionAbbrev);
        }
        public void TestGetCity()
        {
            var addrData = new AddressData();
            var ln       = "EL CAMPO, TX";

            UsCityStateZip.GetState(ln, addrData);
            UsCityStateZip.GetCity(ln, addrData);
            Assert.IsNotNull(addrData.Locality);
            Assert.AreEqual("TX", addrData.RegionAbbrev);
            Assert.AreEqual("El Campo", addrData.Locality);
            Console.WriteLine($"{addrData.Locality} {addrData.RegionAbbrev}");
            ln = "Washington DC 20006";
            UsCityStateZip.GetZipCode(ln, addrData);
            UsCityStateZip.GetState(ln, addrData);
            UsCityStateZip.GetCity(ln, addrData);
            Assert.IsNotNull(addrData.Locality);
            Assert.AreEqual("DC", addrData.RegionAbbrev);
            Assert.AreEqual("Washington", addrData.Locality);
            Console.WriteLine($"{addrData.Locality} {addrData.RegionAbbrev}");
        }
Beispiel #3
0
 internal static void GetProvidence(string lastLine, AddressData addrData)
 {
     UsCityStateZip.GetState(lastLine, addrData, RegexCaPostalProvidenceAbbrev);
 }