示例#1
0
        public void ShouldGetAllZipCodesInBellevueWAInAscendingSortOrder()
        {
            TestablePostalInfoLookupService lookup = GetPostalInfoLookupService();
            List <ZipCode> zips = new List <ZipCode>(lookup.GetZipCodes("", "bellevue", "wa", 5));

            Assert.AreEqual(lookup.NumZipsInBellevue, zips.Count);
            Assert.AreEqual("98005", zips[0].PostalCode);
            Assert.AreEqual("98006", zips[1].PostalCode);
        }
示例#2
0
        public void ShouldGetAllWashingtonCitiesStartingWithA()
        {
            TestablePostalInfoLookupService lookup = GetPostalInfoLookupService();
            List <string> cities = new List <string>(lookup.GetCities("A", "WA", 5));

            Assert.AreEqual(2, cities.Count);
            string[] expectedCities = { "ALGONA", "AUBURN" };
            for (int i = 0; i < expectedCities.Length; ++i)
            {
                Assert.AreEqual(expectedCities[i].ToLowerInvariant(),
                                cities[i].ToLowerInvariant(),
                                "City mismatch at index {0}", i);
            }
        }
示例#3
0
        private static TestablePostalInfoLookupService GetPostalInfoLookupService()
        {
            PostalInfoLookupDataSet ds = new PostalInfoLookupDataSet();

            ds.States.AddStatesRow("CA", "California");
            ds.States.AddStatesRow("OR", "Oregon");
            ds.States.AddStatesRow("WA", "Washington");

            ds.Zip.AddZipRow(53, "98001", "Algona", "WA");
            ds.Zip.AddZipRow(53, "98002", "AUBURN", "WA");
            ds.Zip.AddZipRow(53, "98005", "BELLEVUE", "WA");
            ds.Zip.AddZipRow(53, "98006", "BELLEVUE", "WA");

            ds.Zip.AddZipRow(41, "97201", "PORTLAND", "OR");

            TestablePostalInfoLookupService lookup = new TestablePostalInfoLookupService(ds, 3, 3, 2);

            return(lookup);
        }
        private static TestablePostalInfoLookupService GetPostalInfoLookupService()
        {
            PostalInfoLookupDataSet ds = new PostalInfoLookupDataSet();
            ds.States.AddStatesRow("CA", "California");
            ds.States.AddStatesRow("OR", "Oregon");
            ds.States.AddStatesRow("WA", "Washington");

            ds.Zip.AddZipRow(53, "98001", "Algona", "WA");
            ds.Zip.AddZipRow(53, "98002", "AUBURN", "WA");
            ds.Zip.AddZipRow(53, "98005", "BELLEVUE", "WA");
            ds.Zip.AddZipRow(53, "98006", "BELLEVUE", "WA");

            ds.Zip.AddZipRow(41, "97201", "PORTLAND", "OR");

            TestablePostalInfoLookupService lookup = new TestablePostalInfoLookupService(ds, 3, 3, 2);
            return lookup;
        }