Beispiel #1
0
        public bool ValidateErrors()
        {
            if (_pesel.Length != 11 || !_peselPesel.IsValid())
            {
                LoginValidation.LoginErrors.Add(LoginError.PeselIsNotValid);
            }

            if (_firstName.Length < 2)
            {
                LoginValidation.LoginErrors.Add(LoginError.UserFirstNameIsTooShort);
            }
            else if (!Regex.IsMatch(_firstName, @"^[\p{L} ]+$"))
            {
                LoginValidation.LoginErrors.Add(LoginError.UserFirstNameContainIllegalChars);
            }

            if (_lastName.Length < 2)
            {
                LoginValidation.LoginErrors.Add(LoginError.UserLastNameIsTooShort);
            }
            else if (!Regex.IsMatch(_lastName, @"^[\p{L} ]+$"))
            {
                LoginValidation.LoginErrors.Add(LoginError.UserLastNameContainIllegalChars);
            }

            return(LoginValidation.Error);
        }
Beispiel #2
0
        private void AssertIsPeselValid(string peselString)
        {
            bool isValid = Pesel.IsValid(peselString);

            Assert.IsTrue(isValid);
        }
Beispiel #3
0
 public void Is_PESEL_number_invalid(string peselString)
 {
     // Act & Arrange
     Assert.IsFalse(Pesel.IsValid(peselString));
 }