Esempio n. 1
0
        public void TestPasswordContainingUsernameIsInvalid()
        {
            // Arrange
            String username = "******";
            String password = "******";
            SimplePasswordChecker passwordChecker = new SimplePasswordChecker();

            // Act
            PasswordResult results = passwordChecker.ValidatePassword(username, password);

            // Assert
            Assert.Equal(false, results.ValidPassword);
            Assert.NotEmpty(results.Messages);
            Assert.Contains <String>("Your username of mmouse may not be used as part of the password", results.Messages);
        }
Esempio n. 2
0
        public void TestPasswordWithNoNumbersIsInvalid()
        {
            // Arrange
            String username = "******";
            String password = "******";
            SimplePasswordChecker passwordChecker = new SimplePasswordChecker();

            // Act
            PasswordResult results = passwordChecker.ValidatePassword(username, password);

            // Assert
            Assert.Equal(false, results.ValidPassword);
            Assert.NotEmpty(results.Messages);
            Assert.Contains <String>("The password must contain at least one number", results.Messages);
        }
Esempio n. 3
0
        public void TestEmptyStringPasswordIsInvalid()
        {
            // Arrange
            String username = "******";
            String password = String.Empty;
            SimplePasswordChecker passwordChecker = new SimplePasswordChecker();

            // Act
            PasswordResult results = passwordChecker.ValidatePassword(username, password);

            // Assert
            Assert.Equal(false, results.ValidPassword);
            Assert.NotEmpty(results.Messages);
            Assert.Contains <String>("A password value must be provided", results.Messages);
        }
Esempio n. 4
0
        public void TestPasswordShorterThanEightCharacters()
        {
            // Arrange
            String username = "******";
            String password = "******";
            SimplePasswordChecker passwordChecker = new SimplePasswordChecker();

            // Act
            PasswordResult results = passwordChecker.ValidatePassword(username, password);

            // Assert
            Assert.Equal(false, results.ValidPassword);
            Assert.NotEmpty(results.Messages);
            Assert.Contains <String>("The password must be 8 characters in length or greater", results.Messages);
        }
Esempio n. 5
0
        public void TestPreviouslyUsedPasswordIsInvalid()
        {
            // Arrange
            String username = "******";
            String password = "******";
            SimplePasswordChecker passwordChecker = new SimplePasswordChecker();

            // Act
            PasswordResult results = passwordChecker.ValidatePassword(username, password);

            // Assert
            Assert.Equal(false, results.ValidPassword);
            Assert.NotEmpty(results.Messages);
            Assert.Contains <String>("You have entered a password that you have used before.  Please enter a new password", results.Messages);
        }