示例#1
0
        static void TestApi()
        {
            {
                using var db = new ZipCodeDatabase();
                db.Populate();
            }
            {
                using var db = new ZipCodeDatabase();
                db.Populate();

                var result = db.PopulationOf("00000");

                Debug.Assert(0 == result);

                result = db.PopulationOf("90210");

                Debug.Assert(90210 == result);

                result = db.PopulationOf("20500");

                Debug.Assert(20500 == result);

                result = db.PopulationOf("99999");

                Debug.Assert(99999 == result);

                result = db.PopulationOf("non-existing-zip-code");

                Debug.Assert(0 == result);
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            using var db = new ZipCodeDatabase();
            db.Populate();

            var pop1 = db.PopulationOf("90210");
            var pop2 = db.PopulationOf("20500");

            Console.WriteLine($"pop1: {pop1}, pop2: {pop2}");

            TestApi();
        }