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