public void ValidatePassword_ShouldReturnFalse_WhenPasswordHashAndCorrectHashDoNotMatch() { string password = "******"; string correctHash = HashUtility.CreateHash("!something.Different*"); Assert.False(HashUtility.AreEqual(password, correctHash)); }
public void ValidatePassword_ShouldReturnTrue_WhenPasswordHashAndCorrectHashMatchUsingCodePage1252Characters() { string password = "******"¡#¢$£%¤&¥'¦(§)¨*©+ª,«-¬./®0¯1°2±3²4³5´6µ7¶8·9¸¹;º<»=¼>½?¾@¿AÀBÁCÂDÃEÄFÅGÆHÇIÈJÉKÊLËMÌNÍOÎPÏQÐRÑSÒTÓUÔVÕWÖX×YØZÙ[Ú\\Û]Ü^Ý_Þ`ßaàbácâdãeäfågæhçièjékêlëmìníoîpïqðrñsòtóuôvõwöx÷yøzù{ú|û}ü~ý"; string correctHash = HashUtility.CreateHash(password); Assert.True(HashUtility.AreEqual(password, correctHash)); }
public void ValidatePassword_ShouldReturnTrue_WhenPasswordHashAndCorrectHashMatchUsingAllPrintableAsciiCharacters() { string password = "******"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; string correctHash = HashUtility.CreateHash(password); Assert.True(HashUtility.AreEqual(password, correctHash)); }
public void ValidatePassword_ShouldThrowAFormatException_WhenCorrectHashSaltElementIsNotAMultipleOf4() { string password = "******"; string correctHash = "123:Bar:ABCD"; Assert.Throws <FormatException>(() => HashUtility.AreEqual(password, correctHash)); }
public void ValidatePassword_ShouldReturnTrue_WhenPasswordHashAndCorrectHashMatch() { string password = "******"; string correctHash = HashUtility.CreateHash(password); Assert.True(HashUtility.AreEqual(password, correctHash)); }
public void ValidatePassword_ShouldThrowAFormatException_WhenCorrectHashPasswordHashElementIsEmpty() { string password = "******"; string correctHash = "123:Bar:"; Assert.Throws <FormatException>(() => HashUtility.AreEqual(password, correctHash)); }
public void ValidatePassword_ShouldReturnFalse_WhenCorrectHashDoesNotContainIntegerAsFirstElement() { string password = "******"; string correctHash = "foo:Bar:fluff"; Assert.False(HashUtility.AreEqual(password, correctHash)); }
public void ValidatePassword_ShouldThrowAnInvalidOperationException_WhenCorrectHashSplitLengthIsTooLarge() { string password = "******"; string correctHash = "as:djlkdsf:jkfa:fsdf"; Assert.Throws <InvalidOperationException>(() => HashUtility.AreEqual(password, correctHash)); }
public void ValidatePassword_ShouldThrowAnArgumentNullException_WhenPasswordAndCorrectHashAreWhiteSpace() { string password = "******"; string correctHash = " "; Assert.Throws <ArgumentNullException>(() => HashUtility.AreEqual(password, correctHash)); }
public void ValidatePassword_ShouldThrowAnArgumentNullException_WhenPasswordIsNullAndCorrectHashIsEmpty() { string password = null; string correctHash = ""; Assert.Throws <ArgumentNullException>(() => HashUtility.AreEqual(password, correctHash)); }