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"); }
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"); }
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"); }
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"); }