public void EmprestimoService_Deletar_DeveFalhar() { Livro livro = ObjectMother.ObterLivroValido(); IList <Livro> ListaLivros = new List <Livro>(); ListaLivros.Add(livro); Emprestimo Emprestimo = ObjectMother.ObterEmprestimoValido(ListaLivros); Emprestimo.Id = 0; Action act = () => { emprestimoService.Deletar(Emprestimo); }; act.Should().Throw <IdentifierUndefinedException>(); mockRepositorio.VerifyNoOtherCalls(); }
public void EmprestimoIntegracao_Delete_ShouldBeOk() { Emprestimo emprestimo = ObjetoMaeEmprestimo.obterEmprestimo(); emprestimo.Id = 2; //Executa _service.Deletar(emprestimo); //Saída Emprestimo emprestimodel = _service.Obter(2); emprestimodel.Should().BeNull(); List <Emprestimo> posts = _service.ObterTodos() as List <Emprestimo>; posts.Count().Should().Be(1); }
public void Emprestimo_DeleteIntegracaoSistema_DeveFuncionar() { Livro livro = ObjectMother.ObterLivroValido(); IList <Livro> ListaLivros = new List <Livro>(); ListaLivros.Add(livro); Emprestimo Emprestimo = ObjectMother.ObterEmprestimoValido(ListaLivros); _emprestimoService.Deletar(Emprestimo); Emprestimo emprestimoGetById = _emprestimoService.BuscarPorId(Emprestimo.Id); emprestimoGetById.Should().BeNull(); IList <Emprestimo> emprestimoList = _emprestimoService.BuscarTodos(); emprestimoList.Count().Should().Be(0); }
public void EmprestimoService_Delete_ShouldBeOk() { Emprestimo modelo = ObjetoMaeEmprestimo.obterEmprestimo(); modelo.Id = 1; _mockRepository.Setup(m => m.Delete(modelo)); EmprestimoService service = new EmprestimoService(_mockRepository.Object); service.Deletar(modelo); _mockRepository.Verify(repository => repository.Delete(modelo)); }