public void EmprestimoService_BuscaPorId_DeveFuncionar()
        {
            Livro         livro       = ObjectMother.ObterLivroValido();
            IList <Livro> ListaLivros = new List <Livro>();

            ListaLivros.Add(livro);
            Emprestimo Emprestimo = ObjectMother.ObterEmprestimoValido(ListaLivros);

            mockRepositorio.Setup(m => m.BuscarPorId(Emprestimo.Id)).Returns(Emprestimo);

            Emprestimo result = emprestimoService.BuscarPorId(Emprestimo.Id);

            result.Should().NotBeNull();
            result.Id.Should().Be(1);

            mockRepositorio.Verify(m => m.BuscarPorId(Emprestimo.Id));
        }
Exemple #2
0
        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);
        }