Esempio n. 1
0
        public void VerifyPasswordHash_PlainTextMatchesHashedPassword_ReturnsTrue()
        {
            var processor = new Sha256Processor();

            var result = processor.VerifyPasswordHash(_hashBytes, _saltBytes, "Test Data");

            Assert.That(result, Is.True);
        }
Esempio n. 2
0
        public void VerifyPasswordHash_PasswordSaltNull_ThrowsArgumentNullException()
        {
            var processor = new Sha256Processor();

            var e = Assert.Throws <ArgumentNullException>(() => processor.VerifyPasswordHash(_hashBytes, null, "Test Data"));

            Assert.That(e.Message, Does.Contain("passwordSalt"));
        }
Esempio n. 3
0
        public void VerifyPasswordHash_PlainTextPasswordEmpty_ThrowsArgumentNullException()
        {
            var processor = new Sha256Processor();

            var e = Assert.Throws <ArgumentNullException>(() => processor.VerifyPasswordHash(_hashBytes, _saltBytes, string.Empty));

            Assert.That(e.Message, Does.Contain("plainTextPassword"));
        }
Esempio n. 4
0
        public void VerifyPasswordHash_PlainTextDoesNotMatchHashedPassword_ReturnsFalse()
        {
            var processor = new Sha256Processor();

            var result = processor.VerifyPasswordHash(_hashBytes, _saltBytes, "No Match");

            Assert.That(result, Is.False);
        }