private static NormalStreetTypeFinder GetFinder(AddressParseContainer container)
        {
            var streetTypes = StreetType.From(
                new string[]
            {
                "ALLEY",
                "AVENUE",
                "BOULEVARD",
                "CIRCLE",
                "CONNECTOR",
                "COURT",
                "DRIVE",
                "HIGHWAY",
                "KEY",
                "LANE",
                "LOOP",
                "MALL",
                "PARKWAY",
                "PLACE",
                "ROAD",
                "STREET",
                "SQUARE",
                "TERRACE",
                "WAY"
            });

            var splitter = new AddressSplitter(container);
            var finder   = new NormalStreetTypeFinder(container, streetTypes);

            splitter.SplitAndClean();

            return(finder);
        }
Exemplo n.º 2
0
        private static NonPhysicalStreetTypeFinder GetFinder(AddressParseContainer container)
        {
            var splitter = new AddressSplitter(container);
            var finder   = new NonPhysicalStreetTypeFinder(container);

            splitter.SplitAndClean();

            return(finder);
        }
        private static DirectionalPrefixFinder GetFinder(AddressParseContainer container)
        {
            var splitter = new AddressSplitter(container);
            var finder   = new DirectionalPrefixFinder(container);

            splitter.SplitAndClean();

            return(finder);
        }
        private static PostalCodeFinder GetFinder(AddressParseContainer container)
        {
            var splitter = new AddressSplitter(container);
            var finder   = new PostalCodeFinder(container);

            splitter.SplitAndClean();

            return(finder);
        }
        private static AddressNumberFractionFinder GetFinder(AddressParseContainer container)
        {
            var splitter = new AddressSplitter(container);
            var finder   = new AddressNumberFractionFinder(container);

            splitter.SplitAndClean();

            return(finder);
        }
Exemplo n.º 6
0
        public void Find_PO_Box_1234_Federal_Way_IsNonPhysical_True()
        {
            // Arrange
            var container = new AddressParseContainer(@"PO Box 1234 Federal Way");
            var finder    = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.IsTrue(container.Address.IsNotPhysical);
        }
Exemplo n.º 7
0
        public void Find_1234_Main_St_Seattle_IsNonPhysical_False()
        {
            // Arrange
            var container = new AddressParseContainer(@"1234 Main St Seattle");
            var finder    = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.IsFalse(container.Address.IsNotPhysical);
        }
Exemplo n.º 8
0
        public void Find_PO_Box_NoNumberHere_Federal_Way_Ignores_IsNull()
        {
            // Arrange
            var container = new AddressParseContainer(@"PO Box NoNumberHere Federal Way 98123");
            var finder    = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.IsNull(container.ParsedAddress.StreetType.Value);
        }
        public void Find_Main_St_Set_Index_2()
        {
            // Arrange
            var container = new AddressParseContainer(@"1234 Main St");
            var finder    = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.AreEqual(2, container.ParsedAddress.StreetType.Index);
        }
        public void Find_Broadway_E_Is_A_StreetNameWithNoStreetType()
        {
            // Arrange
            var container = new AddressParseContainer(@"523 Broadway E Apt 664, Seattle WA 98102-5381");
            var finder    = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.AreEqual("Broadway", container.ParsedAddress.StreetName.Value);
        }
        public void Find_1234_Pacific_Hwy_Federal_Way_Ignores_StreetType_IsNull()
        {
            // Arrange
            var container = new AddressParseContainer(@"1234 Pacific Hwy Federal Way");
            var finder    = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.IsNull(container.ParsedAddress.StreetType.Value);
        }
        public void Find_1234_Main_Street_Set_Street()
        {
            // Arrange
            var container = new AddressParseContainer(@"1234 Main Street");
            var finder    = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.AreEqual("Street", container.ParsedAddress.StreetType.Value);
        }
Exemplo n.º 13
0
        public void Find_POB_1234_Federal_Way_Sets_POB()
        {
            // Arrange
            var container = new AddressParseContainer(@"POB 1234 Federal Way 98123");
            var finder    = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.AreEqual("POB", container.ParsedAddress.StreetType.Value);
            Assert.AreEqual(0, container.ParsedAddress.StreetType.Index);
        }
        public void Find_1234_State_Route_134_Federal_Way_Sets_State_Route()
        {
            // Arrange
            var container = new AddressParseContainer(@"1234 State Route 134 Federal Way");
            var finder    = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.AreEqual("State Route", container.ParsedAddress.StreetType.Value);
            Assert.AreEqual(2, container.ParsedAddress.StreetType.Index);
        }
        public void Find_Street_Rd_Set_Rd()
        {
            // Arrange
            var container = new AddressParseContainer(@"1234 Main Street Rd");
            var finder    = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.AreEqual("Rd", container.ParsedAddress.StreetType.Value);
            Assert.AreEqual(3, container.ParsedAddress.StreetType.Index);
        }
        public void Find_1234_Main_St_Sets_1234()
        {
            // Arrange
            var container = new AddressParseContainer(@"1234 Main St");
            var finder    = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.AreEqual("1234", container.ParsedAddress.Number.Value);
            Assert.AreEqual(0, container.ParsedAddress.Number.Index);
        }
        public void Find_Mall_Sq_Set_Sq()
        {
            // Arrange
            var container = new AddressParseContainer(@"1234 Bellevue Mall Sq");
            var finder    = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.AreEqual("Sq", container.ParsedAddress.StreetType.Value);
            Assert.AreEqual(3, container.ParsedAddress.StreetType.Index);
        }
        public void Find_1234_Hwy_555_Federal_Way_Sets_Hwy()
        {
            // Arrange
            var container = new AddressParseContainer(@"1234 Hwy 555 Federal Way");
            var finder    = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.AreEqual("Hwy", container.ParsedAddress.StreetType.Value);
            Assert.AreEqual(1, container.ParsedAddress.StreetType.Index);
        }
        public void Find_1111_Main_St_98144_Ignores()
        {
            // Arrange
            var container = new AddressParseContainer(@"1111 Main St 98144");

            container.ParsedAddress.StreetType.Index = 2;
            container.ParsedAddress.StreetType.Value = "St";
            var finder = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.IsNull(container.ParsedAddress.State.Value);
        }
Exemplo n.º 20
0
        public void Find_1234_North_St_StreetName_Main_City_NotSet()
        {
            // Arrange
            var container = new AddressParseContainer(@"1234 North St");

            container.ParsedAddress.StreetType.Value = "St";
            container.ParsedAddress.StreetType.Index = 2;
            var finder = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.IsTrue(container.ParsedAddress.City.IsNotSet());
        }
Exemplo n.º 21
0
        public void SplitAtPoundSigns_1111_Pound2222_Returns_Parts_Count_3()
        {
            // Arrange
            var container = new AddressParseContainer("fake input");

            container.AddressParts.Add("1111");
            container.AddressParts.Add("#2222");
            var splitter = new AddressSplitter(container);

            // Act
            splitter.SplitAtPoundSigns();

            // Assert
            Assert.AreEqual(3, container.AddressParts.Count);
        }
Exemplo n.º 22
0
        public void Find_1111_Main_St_Pound_22_Seattle_WA_98144_3333_Sets_Pound()
        {
            // Arrange
            var container = new AddressParseContainer(@"1111 Main St # 22 Seattle WA 98144-3333");

            container.ParsedAddress.StreetType.Index = 2;
            container.ParsedAddress.StreetType.Value = "St";
            var finder = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.AreEqual("#", container.ParsedAddress.UnitType.Value);
            Assert.AreEqual(3, container.ParsedAddress.UnitType.Index);
        }
        public void Find_1111_Main_St_Federal_Way_WA_98144_Sets_WA()
        {
            // Arrange
            var container = new AddressParseContainer(@"1111 Main St Federal Way WA 98144");

            container.ParsedAddress.StreetType.Index = 2;
            container.ParsedAddress.StreetType.Value = "St";
            var finder = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.AreEqual("WA", container.ParsedAddress.State.Value);
            Assert.AreEqual(5, container.ParsedAddress.State.Index);
        }
        public void Find_1111_Main_St_Seattle_WA_98144_Sets_98144()
        {
            // Arrange
            var container = new AddressParseContainer(@"1111 Main St Seattle WA 98144");

            container.ParsedAddress.StreetType.Index = 2;
            container.ParsedAddress.StreetType.Value = "St";
            var finder = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.AreEqual("98144", container.ParsedAddress.PostalCode.Value);
            Assert.AreEqual(5, container.ParsedAddress.PostalCode.Index);
        }
Exemplo n.º 25
0
        public void SplitAtHyphens_1111Hyphen2222_All_2_Correct()
        {
            // Arrange
            var container = new AddressParseContainer("fake input");

            container.AddressParts.Add("1111-2222");
            var splitter = new AddressSplitter(container);

            // Act
            splitter.SplitAtHyphens();

            // Assert
            Assert.AreEqual(2, container.AddressParts.Count);
            Assert.AreEqual("1111", container.AddressParts[0]);
            Assert.AreEqual("2222", container.AddressParts[1]);
        }
        public void Find_1234_E_N_S_St_DirectionalPrefix_N()
        {
            // Arrange
            var container = new AddressParseContainer(@"1234 E N S St");

            container.ParsedAddress.StreetType.Value = "St";
            container.ParsedAddress.StreetType.Index = 4;
            var finder = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.AreEqual("N", container.ParsedAddress.DirectionalPrefix.Value);
            Assert.AreEqual(2, container.ParsedAddress.DirectionalPrefix.Index);
        }
Exemplo n.º 27
0
        public void Find_1234_Main_St_Seattle_City_Seattle()
        {
            // Arrange
            var container = new AddressParseContainer(@"1234 North St Seattle");

            container.ParsedAddress.StreetType.Value = "St";
            container.ParsedAddress.StreetType.Index = 2;
            var finder = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.AreEqual("Seattle", container.ParsedAddress.City.Value);
            Assert.AreEqual(3, container.ParsedAddress.City.Index);
        }
        public void Find_1234_E_E_St_E_DirectionalPrefix_Index1_E_EitherOr()
        {
            // Arrange
            var container = new AddressParseContainer(@"1234 E E St E");

            container.ParsedAddress.StreetType.Value = "St";
            container.ParsedAddress.StreetType.Index = 3;
            var finder = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.AreEqual("E", container.ParsedAddress.DirectionalPrefix.Value);
            Assert.AreEqual(1, container.ParsedAddress.DirectionalPrefix.Index);
        }
Exemplo n.º 29
0
        public void Find_1234_Main_St_N_Apt_N_North_Bend_DirectionalSuffix_N()
        {
            // Arrange
            var container = new AddressParseContainer(@"1234 Main St N Apt N North Bend");

            container.ParsedAddress.StreetType.Value = "St";
            container.ParsedAddress.StreetType.Index = 2;
            var finder = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.AreEqual("N", container.ParsedAddress.DirectionalSuffix.Value);
            Assert.AreEqual(3, container.ParsedAddress.DirectionalSuffix.Index);
        }
        public void Find_1234_S_North_St_DirectionalPrefix_S()
        {
            // Arrange
            var container = new AddressParseContainer(@"1234 S North St");

            container.ParsedAddress.StreetType.Value = "St";
            container.ParsedAddress.StreetType.Index = 3;
            var finder = GetFinder(container);

            // Act
            finder.Find();

            // Assert
            Assert.AreEqual("S", container.ParsedAddress.DirectionalPrefix.Value);
            Assert.AreEqual(1, container.ParsedAddress.DirectionalPrefix.Index);
        }