public void Integration_UpdateEmprestimo_ShouldBeOK() { _emprestimo = ObjectMother.GetEmprestimoComId(); _service.Editar(_emprestimo); var livroVerify = _service.Get(_emprestimo.Id); livroVerify.Should().NotBeNull(); livroVerify.Id.Should().Be(_emprestimo.Id); }
public void Service_Emprestimo_Deveria_Editar_Emprestimo() { _emprestimo = ObjectMother.GetEmprestimoComId(); _repository .Setup(l => l.Editar(It.IsAny <Emprestimo>())); _service.Editar(_emprestimo); _repository.Verify(l => l.Editar(_emprestimo)); }
public void EmprestimoService_Editar_IdInvalido_ShouldBeFail() { Emprestimo modelo = ObjectMotherEmprestimo.GetEmprestimo(); modelo.Livro = _livro; EmprestimoService service = new EmprestimoService(_mockRepositorio.Object); Action comparison = () => service.Editar(modelo); comparison.Should().Throw <ExcecaoIdentifivadorIndefinido>(); _mockRepositorio.VerifyNoOtherCalls(); }
public void EmprestimoService_Editar_NomeClienteInvalido_ShouldBeFail() { Emprestimo modelo = ObjectMotherEmprestimo.GetEmprestimoInvalidoClienteNome(); modelo.Id = 1; modelo.Livro = _livro; EmprestimoService service = new EmprestimoService(_mockRepositorio.Object); Action comparison = () => service.Editar(modelo); comparison.Should().Throw <ExcecaoNomeClienteNulo>(); _mockRepositorio.VerifyNoOtherCalls(); }
public void EmprestimoService_Editar_ShouldBeOk() { Emprestimo modelo = ObjectMotherEmprestimo.GetEmprestimo(); modelo.Id = 1; modelo.Livro = _livro; _mockRepositorio.Setup(m => m.Editar(modelo)).Returns(new Emprestimo() { Id = 1, NomeCliente = "Nome do Cliente" }); EmprestimoService service = new EmprestimoService(_mockRepositorio.Object); Emprestimo resultado = service.Editar(modelo); resultado.Should().NotBeNull(); _mockRepositorio.Verify(repositorio => repositorio.Editar(modelo)); }