public void CanMatchMaxNoOfAllowedCharacterRepetitions() { // Arrange PasswordPolicy policy = new PasswordPolicy { MaxNoOfAllowedCharacterRepetitions = 2 }; // Act + Assert Assert.IsTrue(policy.IsValid("aabb")); Assert.IsFalse(policy.IsValid("xaaay")); }
public void CanMatchMinNoOfMinNoOfLowerCaseChars() { // Arrange PasswordPolicy policy = new PasswordPolicy { MinNoOfLowerCaseChars = 3 }; // Act + Assert Assert.IsTrue(policy.IsValid("1a2bc")); Assert.IsFalse(policy.IsValid("1A2bC")); Assert.IsFalse(policy.IsValid("1A2BC")); }
public void CanMatchPasswordLength() { // Arrange PasswordPolicy policy = new PasswordPolicy { MinPasswordLength = 5 }; // Act + Assert Assert.IsTrue(policy.IsValid("12345")); Assert.IsFalse(policy.IsValid("1234")); }
public void CanMatchMinNoOfNumbers() { // Arrange PasswordPolicy policy = new PasswordPolicy { MinNoOfNumbers = 3 }; // Act + Assert Assert.IsTrue(policy.IsValid("a12b3")); Assert.IsFalse(policy.IsValid("a1xb3")); }