public void change_password()
        {
            var author = new Author()
            {
                Email = "*****@*****.**",
                HashedPassword = Hasher.GetMd5Hash("mzblog")
            };
            using (var _db = new LiteDatabase(_dbConfig.DbPath))
            {
                var authorCol = _db.GetCollection<Author>(DBTableNames.Authors);
                authorCol.Insert(author);

                new ChangePasswordCommandInvoker(_dbConfig)
                    .Execute(new ChangePasswordCommand()
                    {
                        AuthorId = author.Id,
                        OldPassword = "******",
                        NewPassword = "******",
                        NewPasswordConfirm = "pswtest"
                    })
                    .Success.Should().BeTrue();

                authorCol.FindById(author.Id).HashedPassword.Should().BeEquivalentTo(Hasher.GetMd5Hash("pswtest"));
            }
        }
 public void change_password_fail_if_old_password_does_not_match()
 {
     var author = new Author()
     {
         Id = authorId,
         Email = "*****@*****.**",
         HashedPassword = Hasher.GetMd5Hash("mzblog")
     };
     _db.Insert(DBTableNames.Authors, author);
     new ChangePasswordCommandInvoker(_db)
        .Execute(new ChangePasswordCommand()
        {
            AuthorId = author.Id,
            OldPassword = "******",
            NewPassword = "******",
            NewPasswordConfirm = "pswtest"
        })
        .Success.Should().BeFalse();
 }
        public void login_should_fail_if_invalid_password_provided()
        {
            var documtnt = new Author()
            {
                Email = "*****@*****.**",
                HashedPassword = Hasher.GetMd5Hash("psw1")
            };
            using (var _db = new LiteDatabase(_dbConfig.DbPath))
            {
                var authorCol = _db.GetCollection<Author>(DBTableNames.Authors);
                authorCol.Insert(documtnt);
            }
            var loginCommandInvoker = new LoginCommandInvoker(_dbConfig);

            loginCommandInvoker.Execute(new LoginCommand()
            {
                Email = "*****@*****.**",
                Password = "******"
            }).Success.Should().BeFalse();
        }
        public void change_password()
        {
            var author = new Author()
            {
                Email = "*****@*****.**",
                HashedPassword = Hasher.GetMd5Hash("mzblog")
            };

            _db.Insert(DBTableNames.Authors, author);

            new ChangePasswordCommandInvoker(_db)
                .Execute(new ChangePasswordCommand()
                {
                    AuthorId = author.Id,
                    OldPassword = "******",
                    NewPassword = "******",
                    NewPasswordConfirm = "pswtest"
                })
                .Success.Should().BeTrue();

            _db.SelectKey<Author>(DBTableNames.Authors, author.Id).HashedPassword.Should().BeEquivalentTo(Hasher.GetMd5Hash("pswtest"));
        }
 public void change_password_fail_if_old_password_does_not_match()
 {
     var author = new Author()
     {
         Id = authorId,
         Email = "*****@*****.**",
         HashedPassword = Hasher.GetMd5Hash("mzblog")
     };
     using (var _db = new LiteDatabase(_dbConfig.DbPath))
     {
         var authorCol = _db.GetCollection<Author>(DBTableNames.Authors);
         authorCol.Insert(author);
     }
     new ChangePasswordCommandInvoker(_dbConfig)
        .Execute(new ChangePasswordCommand()
        {
            AuthorId = author.Id,
            OldPassword = "******",
            NewPassword = "******",
            NewPasswordConfirm = "pswtest"
        })
        .Success.Should().BeFalse();
 }