Example #1
0
 public void whenUserIsAnAdminAndPasswordHasNoSpecialCharsValidatorShouldReturnFailure()
 {
     var adminValidator = new PasswordValidator(10, true);
     var messages = adminValidator.Validate("aa22334466");
     Assert.IsTrue(messages.Count > 0);
     Assert.IsTrue(messages.Contains(PasswordValidator.passwordNeedsToHaveAtLeastOneSpecialCharacter));
 }
Example #2
0
 public void whenUserIsAnAdminAndPasswordIsLessThan10CharsValidatorShouldReturnFailure()
 {
     var adminValidator = new PasswordValidator(10, true);
     var messages = adminValidator.Validate("1a!223344");
     Assert.IsTrue(messages.Count > 0);
     Assert.AreEqual(true,
                     messages.Contains(
         string.Format(PasswordValidator.passwordNeedsToBeDAtLeastFormat,10)));
     //			Assert.AreEqual(false, adminValidator.Validate("11"));
     //			Assert.AreEqual(false, adminValidator.Validate("11223344"));
 }
Example #3
0
 public void Initialize()
 {
     validator = new PasswordValidator(7);
 }
Example #4
0
 public void whenUserIsAnAdminAndPasswordIsMoreThan10CharsValidatorShouldReturnSuccess()
 {
     var adminValidator = new PasswordValidator(10, true);
     var messages = adminValidator.Validate("aa2!334466");
     Assert.IsTrue(messages.Count == 0);
     //			Assert.AreEqual(true, adminValidator.Validate("1122334455"));
 }