public void Parse_OraclePasswordDoesNotHaveSpecialCharacter_ExceptionThrown() { // Password without special characers // The test good password is ValidP@ssw0rd // The at symbol has been replaced with a lowercase 'a' string password = "******"; OraclePasswordRules passwordRules = new OraclePasswordRules(); Exception exception = Assert.Throws<Exception>(() => passwordRules.Verify(password)); Assert.AreEqual(exception.Data["UserMessage"], "Password must contain at least one approved special character."); }
public void Parse_OraclePasswordDoesNotHaveNumericCharacter_ExceptionThrown() { // Password without a numeric character // The test good password is ValidP@ssw0rd // The zero has been changed to a lowercase 'o' string password = "******"; OraclePasswordRules passwordRules = new OraclePasswordRules(); Exception exception = Assert.Throws<Exception>(() => passwordRules.Verify(password)); Assert.AreEqual(exception.Data["UserMessage"], "Password must contain at least one numeric character."); }
public void Parse_OraclePasswordDoesNotHaveUppercaseLetter_ExceptionThrown() { // Lowercase password // The test good password is ValidP@ssw0rd // All letters have been converted to lowercase string password = "******"; OraclePasswordRules passwordRules = new OraclePasswordRules(); Exception exception = Assert.Throws<Exception>(() => passwordRules.Verify(password)); Assert.AreEqual(exception.Data["UserMessage"], "Password must contain at least one uppercase character."); }
public void Parse_OraclePasswordGreaterThanThirtyCharacters_ExceptionThrown() { // Thrity one character password // The test good password is ValidP@ssw0rd // The password has been repeated with the final characters removed to make a thirty one character password string password = "******"; OraclePasswordRules passwordRules = new OraclePasswordRules(); Exception exception = Assert.Throws<Exception>(() => passwordRules.Verify(password)); Assert.AreEqual(exception.Data["UserMessage"], "Password length cannot exceed thirty characters."); }
public void Parse_OraclePasswordLessThanEightCharacters_ExceptionThrown() { // Seven character password // The test good password is ValidP@ssw0rd // The last six characters have been removed to make a seven character password string password = "******"; OraclePasswordRules passwordRules = new OraclePasswordRules(); Exception exception = Assert.Throws<Exception>(() => passwordRules.Verify(password)); Assert.AreEqual(exception.Data["UserMessage"], "Password must contain eight or more characters."); }
public void Parse_OraclePasswordIsValid_DoesNotThrowException() { // The test good password is ValidP@ssw0rd string password = "******"; OraclePasswordRules passwordRules = new OraclePasswordRules(); Assert.DoesNotThrow(() => passwordRules.Verify(password)); }
public void Parse_OraclePasswordHasInvalidCharacter_ExceptionThrown() { // Password with invalid character, the pound sign (#) is invalid // The test good password is ValidP@ssw0rd // The pound sign has been added string password = "******"; OraclePasswordRules passwordRules = new OraclePasswordRules(); Exception exception = Assert.Throws<Exception>(() => passwordRules.Verify(password)); Assert.AreEqual(exception.Data["UserMessage"], "Invalid character found in password."); }