public void FailWhenEmpty()
 {
     Assert.ThrowsException <ArgumentException>(() =>
     {
         var empty = new Domain.ValueObjects.Password("");
     });
 }
        public Password_VerifyShould()
        {
            _validPassword = "******";
            var password = new Domain.ValueObjects.Password(_validPassword);

            _validHash = password.Hash;
            _validSalt = password.Salt;
        }
        public void SetTheHashAndSalt()
        {
            var password = new Domain.ValueObjects.Password("password");

            Assert.IsFalse(password.PlainText == null);
            Assert.IsFalse(password.Hash == null);
            Assert.IsFalse(password.Salt == null);
        }
        public void FailWhenSaltLengthIsWrong()
        {
            var random = new Random();
            var length = random.Next();

            while (length == 128)
            {
                length = random.Next();
            }
            var salt     = new byte[length];
            var password = new Domain.ValueObjects.Password(_validPassword, _validHash, salt);

            Assert.ThrowsException <ArgumentException>(() =>
            {
                var verify = password.Verify();
            });
        }
        public void PassWithCorrectPassword()
        {
            var password = new Domain.ValueObjects.Password(_validPassword, _validHash, _validSalt);

            Assert.IsTrue(password.Verify());
        }
        public void FailWithIncorrectPassword()
        {
            var password = new Domain.ValueObjects.Password("wrongpassword", _validHash, _validSalt);

            Assert.IsFalse(password.Verify());
        }