Validate the length of the password against the value set in the web.config/system.web/membership section.
Inheritance: PropertyRule
コード例 #1
0
ファイル: FactoryTests.cs プロジェクト: kahanu/MvcInstaller
        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);
        }
コード例 #2
0
ファイル: FactoryTests.cs プロジェクト: kahanu/MvcInstaller
        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);
        }
コード例 #3
0
ファイル: FactoryTests.cs プロジェクト: kahanu/MvcInstaller
        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);
        }