Пример #1
0
        public void Verify_ValidPasswordAndHash_ReturnsTrue(PasswordHashPair passwordHashPair)
        {
            // Arrange
            string correctPassword = passwordHashPair.Password;
            string expectedHash    = passwordHashPair.Hash;

            // Act
            bool result = PasswordHelper.Verify(correctPassword, expectedHash);

            // Assert
            Assert.IsTrue(result);
        }
Пример #2
0
        public void Verify_InvalidPasswordAndHash_ReturnsFalse(PasswordHashPair passwordHashPair)
        {
            // Arrange
            string wrongPassword = passwordHashPair.Password;
            string expectedHash  = passwordHashPair.Hash;

            // Act
            bool result = PasswordHelper.Verify(wrongPassword, expectedHash);

            // Assert
            Assert.IsFalse(result);
        }
Пример #3
0
        public void Hash_HashWithoutSalt_CheckIfReturnsValidSha256Hash(PasswordHashPair passwordHashPair)
        {
            // Arrange
            string givenPassword = passwordHashPair.Password;
            string expectedHash  = passwordHashPair.Hash;

            // Act
            string actualHash = PasswordHelper.Hash(givenPassword);

            // Assert
            Assert.AreEqual(expectedHash, actualHash);
        }