Exemplo n.º 1
0
        public void CanMatchMaxNoOfAllowedCharacterRepetitions()
        {
            // Arrange
              PasswordPolicy policy = new PasswordPolicy
              {
            MaxNoOfAllowedCharacterRepetitions = 2
              };

              // Act + Assert
              Assert.IsTrue(policy.IsValid("aabb"));
              Assert.IsFalse(policy.IsValid("xaaay"));
        }
Exemplo n.º 2
0
        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"));
        }
Exemplo n.º 3
0
        public void CanMatchPasswordLength()
        {
            // Arrange
              PasswordPolicy policy = new PasswordPolicy
              {
            MinPasswordLength = 5
              };

              // Act + Assert
              Assert.IsTrue(policy.IsValid("12345"));
              Assert.IsFalse(policy.IsValid("1234"));
        }
Exemplo n.º 4
0
        public void CanMatchMinNoOfNumbers()
        {
            // Arrange
              PasswordPolicy policy = new PasswordPolicy
              {
            MinNoOfNumbers = 3
              };

              // Act + Assert
              Assert.IsTrue(policy.IsValid("a12b3"));
              Assert.IsFalse(policy.IsValid("a1xb3"));
        }