Пример #1
0
        public void TestZipCodeParser()
        {
            const string usa1   = "021270000";
            const string usa2   = "01800-0000";
            const string canada = "B1N1W7";
            const string reject = "0212-3345";

            string results;

            Assert.IsTrue(GeneralUtility.TryParseZipCode(usa1, out results));
            Console.WriteLine(results);

            Assert.IsTrue(GeneralUtility.TryParseZipCode(usa2, out results));
            Console.WriteLine(results);

            Assert.IsTrue(GeneralUtility.TryParseZipCode(canada, out results));
            Console.WriteLine(results);

            Assert.IsFalse(GeneralUtility.TryParseZipCode(reject, out results));
            Console.WriteLine(results);
        }