コード例 #1
0
ファイル: HelpersTests.cs プロジェクト: 2644783865/ssd-cms
 public void TestPhoneNumber()
 {
     Assert.AreEqual(true, ConstraintHelper.ValidatePhoneNumber("0123456789"));
     Assert.AreEqual(true, ConstraintHelper.ValidatePhoneNumber("0 123 456 789"));
     Assert.AreEqual(true, ConstraintHelper.ValidatePhoneNumber("+48 012 345 6789"));
     Assert.AreEqual(false, ConstraintHelper.ValidatePhoneNumber("0123t456789"));
     Assert.AreEqual(false, ConstraintHelper.ValidatePhoneNumber("test"));
 }
コード例 #2
0
        private bool ValidateForm()
        {
            var result = true;

            result = !ValidationHelper.ValidateTextFiled(LoginBox.Text.Length > 0, LoginBox) ? false : result;
            result = !ValidationHelper.ValidateTextFiled(NameBox.Text.Length > 0, NameBox) ? false : result;
            result = !ValidationHelper.ValidateTextFiled(PhoneBox.Text.Length > 0 && ConstraintHelper.ValidatePhoneNumber(PhoneBox.Text), PhoneBox) ? false : result;
            result = !ValidationHelper.ValidateTextFiled(ConstraintHelper.ValidateEmail(EmailBox.Text), EmailBox) ? false : result;
            return(result);
        }