예제 #1
0
        public void ShouldReturnFalseForIncorrectMobilePhone()
        {
            string[] testValues = new string[] { "+48696588", "+4869658813", "+486965881", "+48 696 588", "+48 696 588 13", "+48 696 588 1", "some text", string.Empty };

            foreach (string item in testValues)
            {
                Assert.IsFalse(ValidateRegex.IsMobilePhone(item));
            }
        }
예제 #2
0
        public void ShouldReturnTrueForCorrectMobilePhone()
        {
            string[] testValues = new string[] { "+48696588133", "48696588133", "48 696 588 133", "+48 696 588 133", "+48 696 588 133" };

            foreach (string item in testValues)
            {
                Assert.IsTrue(ValidateRegex.IsMobilePhone(item));
            }
        }
예제 #3
0
 /// <summary>
 /// The method validates whether a supplied object is valid against a mobile phone pattern.
 /// </summary>
 /// <param name="objectToValidate">An object to be valdiated against regex pattern of a mobile phone number.</param>
 /// <returns>True - if object is valid, false - if object is invalid.</returns>
 public override bool Validate(object objectToValidate)
 {
     return(ValidateRegex.IsMobilePhone(objectToValidate, pattern));
 }
예제 #4
0
        public void MobilePhone_ShouldReturnFalseForValueType()
        {
            decimal testValue = 12345;

            Assert.IsFalse(ValidateRegex.IsMobilePhone(testValue));
        }
예제 #5
0
        public void MobilePhone_ShouldReturnFalseForEmptyObject()
        {
            object testValue = new object();

            Assert.IsFalse(ValidateRegex.IsMobilePhone(testValue));
        }