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)); }
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")); }
public void Initialize() { validator = new PasswordValidator(7); }
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")); }