private static bool Match(string number, PhoneRegex pattern, bool allowPrefixMatch) { var matcher = pattern.MatchBeginning(number); if (!matcher.Success) { return(false); } return(pattern.MatchAll(number).Success || allowPrefixMatch); }
private static bool Match(string number, PhoneRegex pattern, bool allowPrefixMatch) => allowPrefixMatch?pattern.IsMatchBeginning(number) : pattern.IsMatchAll(number);
public void GetGeneratedPhoneNumber_Works() { var phoneNumber = LeadGenerator.GetGeneratedPhoneNumber(new StringBuilder(), new Random()); Assert.IsTrue(PhoneRegex.IsMatch(phoneNumber)); }