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