Validate the length of the password against the value set in the web.config/system.web/membership section.
Inheritance: PropertyRule
Ejemplo n.º 1
0
        public void min_required_password_length_should_return_true_for_valid_length()
        {
            // Arrange
            string password = "******";
            string username = "******";
            int requiredPasswordLength = 7;

            // Act
            var rule = new MinRequiredPasswordLength(username, password.Length, requiredPasswordLength);
            bool actual = rule.Validate();

            // Assert
            Assert.AreEqual(true, actual);
        }
Ejemplo n.º 2
0
        public void min_required_password_length_succeeds_with_zero_min_password_length()
        {
            // Arrange
            string password = "******";
            string username = "******";
            int requiredPasswordLength = 0;

            // Act
            var rule = new MinRequiredPasswordLength(username, password.Length, requiredPasswordLength);
            bool actual = rule.Validate();

            // Assert
            Assert.IsTrue(actual);
        }
Ejemplo n.º 3
0
        public void min_required_password_length_message_succeeds()
        {
            // Arrange
            string password = "******";
            string username = "******";
            int requiredPasswordLength = 7;

            // Act
            var rule = new MinRequiredPasswordLength(username, password.Length, requiredPasswordLength);
            bool actual = rule.Validate();

            // Assert
            Assert.AreEqual(string.Format("The password for 'joeuser' is less than the required 7 character length.", requiredPasswordLength), rule.ErrorMessage);
        }