public void Test_EmprestimoService_Delete_Test_Should_BeOk()
        {
            _mock.Setup(x => x.Delete(_emprestimo));

            Alvo.Delete(_emprestimo);

            _mock.Verify(x => x.Delete(_emprestimo));
        }
        public void EmprestimoService_Delete_IdInvalido_ShouldBeFail()
        {
            Emprestimo modelo = ObjectMotherEmprestimo.GetEmprestimo();

            modelo.Livro = _livro;
            EmprestimoService service    = new EmprestimoService(_mockRepositorio.Object);
            Action            comparison = () => service.Delete(modelo);

            comparison.Should().Throw <ExcecaoIdentifivadorIndefinido>();
            _mockRepositorio.VerifyNoOtherCalls();
        }
        public void EmprestimoService_Delete_ShouldBeOk()
        {
            Emprestimo modelo = ObjectMotherEmprestimo.GetEmprestimo();

            modelo.Id    = 1;
            modelo.Livro = _livro;
            _mockRepositorio.Setup(m => m.Delete(modelo));
            EmprestimoService service = new EmprestimoService(_mockRepositorio.Object);

            service.Delete(modelo);
            _mockRepositorio.Verify(repositorio => repositorio.Delete(modelo));
        }
Esempio n. 4
0
        public void Delete_Deveria_Deletar_Um_Emprestimo()
        {
            //Arrange
            _emprestimoRepositoryMockObject.Setup(x => x.Delete(_emprestimoDefaultWithId));

            //Action
            Action emprestimoDeleteAction = () => _emprestimoService.Delete(_emprestimoDefaultWithId);

            //Assert
            emprestimoDeleteAction.Should().NotThrow <Exception>();
            _emprestimoRepositoryMockObject.Verify(x => x.Delete(_emprestimoDefaultWithId), Times.Once());
            _emprestimoRepositoryMockObject.Verify(x => x.Delete(_emprestimoDefaultWithId));
        }
        public void Sistema_Deveria_Deletar_Um_Emprestimo_Pelo_Id()
        {
            Emprestimo resultEmprestimo = _emprestimoService.Add(_emprestimoDefault);

            //Action
            _emprestimoService.Delete(resultEmprestimo);

            //Assert
            Emprestimo         resultGet    = _emprestimoService.Get(resultEmprestimo.Id);
            IList <Emprestimo> resultGetAll = _emprestimoService.GetAll();

            resultGet.Should().BeNull();
            resultGetAll.Should().HaveCount(1);
        }