Esempio n. 1
0
        public void MustFailForIncorrectPhoneNumber()
        {
            string pattern  = @"^(\(?\d\d\d\)?)?( |-|\.)?\d\d\d( |-|\.)?\d{4,4}(( |-|\.)?[ext\.]+ ?\d+)?$";
            string testName = "Vasiliy123";

            bool result = RegularExpressions.Match(testName, pattern);

            Assert.IsFalse(result, "Incorrect number matches pattern");
        }
Esempio n. 2
0
        public void MustFailForIncorrectNames()
        {
            string pattern  = @"^[A-Z][a-zA-Z]+$";
            string testName = "Vasiliy123";

            bool result = RegularExpressions.Match(testName, pattern);

            Assert.IsFalse(result, "Incorreect name matches pattern");
        }
Esempio n. 3
0
        public void MustMatchCorrectPhoneNumber()
        {
            string pattern  = @"^(\(?\d\d\d\)?)?( |-|\.)?\d\d\d( |-|\.)?\d{4,4}(( |-|\.)?[ext\.]+ ?\d+)?$";
            string testName = "(098)666-4444";

            bool result = RegularExpressions.Match(testName, pattern);

            Assert.IsTrue(result, "Correct number match failed");
        }
Esempio n. 4
0
        public void MustMatchCorrectNames()
        {
            string pattern  = @"^[A-Z][a-zA-Z]+$";
            string testName = "Vasiliy";

            bool result = RegularExpressions.Match(testName, pattern);

            Assert.IsTrue(result, "Name does not match pattern");
        }