Example #1
0
        private static void TestZipCodeRepository()
        {
            IZipCodeRepository zipCodeRepository = new ZipCodeRepository();

            List <ZipCode> zipCodes1 = zipCodeRepository.Get();
            int            count     = zipCodes1.Count;

            Console.WriteLine($"zipCodes1.Count() = {count}");

            const string   stateString = "NJ";
            List <ZipCode> zipCodes2   = zipCodeRepository.GetByState(stateString);

            count = zipCodes2.Count;
            Console.WriteLine($"zipCodes2.Count() = {count}");

            ZipCode zipCode = new ZipCode
            {
                City  = "LINCOLN PARK",
                State = new State {
                    Abbreviation = "NJ"
                },
                Zip = "07035"
            };
            const int      range     = 10000;
            List <ZipCode> zipCodes3 = zipCodeRepository.GetZipCodesForRange(zipCode, range);

            count = zipCodes3.Count;
            Console.WriteLine($"zipCodes3.Count() = {count}");
        }