public void Sistema_Deveria_Salvar_Um_Novo_Emprestimo_E_Retornar_Do_Banco()
        {
            //Action-Arrange
            Emprestimo resultEmprestimo = _emprestimoService.Add(_emprestimoDefault);

            //Assert
            resultEmprestimo.Should().NotBeNull();
            resultEmprestimo.Id.Should().NotBe(0);

            Emprestimo resultGet = _emprestimoService.Get(resultEmprestimo.Id);

            resultGet.Should().NotBeNull();
            resultGet.Should().Equals(resultEmprestimo);
        }
        public void Test_EmprestimoService_Add_Test_Should_BeOk()
        {
            _mock.Setup(x => x.Add(_emprestimo)).Returns(new Emprestimo()
            {
                Id = 1
            });

            var obtido = Alvo.Add(_emprestimo);

            _mock.Verify(x => x.Add(_emprestimo));
            obtido.Id.Should().BeGreaterThan(0);
        }
Beispiel #3
0
        public void Add_Deveria_incluir_Novo_Emprestimo()
        {
            //Arrange
            _emprestimoRepositoryMockObject.Setup(p => p.Save(It.IsAny <Emprestimo>())).Returns(_emprestimoDefaultWithId);

            //Action
            Emprestimo retornoEmprestimo = _emprestimoService.Add(_emprestimoDefaultWithId);

            //Assert
            _emprestimoRepositoryMockObject.Verify(p => p.Save(It.IsAny <Emprestimo>()));
            _emprestimoRepositoryMockObject.Verify(p => p.Save(It.IsAny <Emprestimo>()), Times.Once());
            retornoEmprestimo.Id.Should().BeGreaterThan(0);
            retornoEmprestimo.Id.Should().Be(_emprestimoDefaultWithId.Id);
        }