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); }
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); }
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); }
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); }
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); }