public void CriarEmprestimoValido_DeveFuncionar() { IList <Livro> ListaLivros = new List <Livro>(); ListaLivros.Add(LivroMock.Object); Emprestimo emprestimo = ObjectMother.ObterEmprestimoValido(ListaLivros); emprestimo.Validate(); emprestimo.Id.Should().Be(1); }
public void Emprestimo_AtualizarRepositorio_DeveFalhar() { IList <Livro> ListaLivros = _repositorioLivro.BuscarTodos(); Emprestimo Emprestimo = ObjectMother.ObterEmprestimoValido(ListaLivros); Emprestimo.Id = 0; Action act = () => Emprestimo.Validate(); act.Should().Throw <IdentifierUndefinedException>(); }
public void CriarEmprestimoInvalidoQuantidadeMinimaLivros_DeveFalhar() { IList <Livro> ListaLivros = new List <Livro>(); ListaLivros.Add(LivroMock.Object); Emprestimo emprestimo = ObjectMother.ObterEmprestimoValido(ListaLivros); emprestimo.Livros.Clear(); Action act = () => emprestimo.Validate(); act.Should().Throw <BookwitchMinimumException>(); }
public void Deletar(Emprestimo entidade) { entidade.Validate(); if (entidade.Livros.Count >= 1) { foreach (var item in entidade.Livros) { Db.Delete(SqlDeleteSecundaria, TakeSecundario(entidade, item)); } } Db.Delete(SqlDelete, Take(entidade)); }
public void Deletar(Emprestimo entidade) { entidade.Validate(); _repositorio.Deletar(entidade); }
public Emprestimo Atualizar(Emprestimo entidade) { entidade.Validate(); entidade = _repositorio.Atualizar(entidade); return(entidade); }
public Emprestimo Atualizar(Emprestimo entidade) { entidade.Validate(); Db.Update(SqlUpdate, Take(entidade)); return(entidade); }