public void Teste_Aplicacao_NotaFiscal_Emitir_ChaveRepetida_EsperadoOK() { _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); bool retorno = false; _mockNotaFiscal.Setup(r => r.GerarChave(_random)); _mockNotaFiscal.Setup(r => r.CalcularValorTotalNota()); _mockNotaFiscalRepositorio.Setup(r => r.ValidarExistenciaPorChave(_notaFiscal.Chave)) .Returns(() => retorno == false ? (retorno = true) : (retorno = false)); _mockNotaFiscalRepositorio .Setup(nfr => nfr.InserirNotaFiscalEmitida(_notaFiscal)); _mockNfeRepositorio .Setup(nf => nf.DeletarPorNotaFiscalID(1)) .Returns(true); _mockNotaFiscalRepositorio.Setup(nfr => nfr.Deletar(1)).Returns(true); var notaFiscal = _notaFiscalServico.EmitirNota(_notaFiscal); _mockNotaFiscalRepositorio.Verify(nfr => nfr.InserirNotaFiscalEmitida(_notaFiscal)); notaFiscal.Should().BeTrue(); }
public void Teste_Dominio_NotaFiscal_ObterIPI_EsperadoOK() { _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); Action action = () => _notaFiscal.ObterIPI(); action.Should().NotThrow(); }
public void NotaFiscal_InfraPdf_Emitir_EsperadoOK() { _notafiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); var emitido = _notaFiscalPdf.Exportar(_notafiscal); emitido.Should().Be(true); }
public void Teste_Dominio_NotaFiscal_CalcularValorTotalProdutos_EsperadoOK() { _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); double retorno = _notaFiscal.CalcularValorTotalProdutos(); _notaFiscal.ValorTotalProdutos.Should().BeGreaterThan(0); retorno.Should().Be(_notaFiscal.ValorTotalProdutos); }
public void NotaFiscal_InfraData_Atualizar_ComEmitenteInvalido_EsperadoFalha() { _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); _notaFiscal.Emitente = null; Action action = () => _notaFiscalRepositorio.Atualizar(_notaFiscal); action.Should().Throw <ExcecaoEmitenteNulo>(); }
public void NotaFiscal_InfraData_Inserir_ComDestinatarioInvalido_EsperadoFalha() { _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); _notaFiscal.Destinatario = null; Action action = () => _notaFiscalRepositorio.Inserir(_notaFiscal); action.Should().Throw <ExcecaoDestinatarioNulo>(); }
public void NotaFiscal_InfraData_Inserir_ComChaveInvalida_EsperadoFalha() { _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); _notaFiscal.Chave = String.Empty; Action action = () => _notaFiscalRepositorio.Inserir(_notaFiscal); action.Should().Throw <ExcecaoChaveInvalida>(); }
public void NotaFiscal_InfraData_Inserir_ComDataEntradaInvalida_EsperadoFalha() { _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); _notaFiscal.DataEntrada = DateTime.Now.AddDays(-1); Action action = () => _notaFiscalRepositorio.Inserir(_notaFiscal); action.Should().Throw <ExcecaoDataEntradaInvalida>(); }
public void NotaFiscal_InfraData_Atualizar_EsperadoOK() { BaseSqlTeste.SemearBancoParaNotaFiscal(); _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); NotaFiscal notaFiscal = _notaFiscalRepositorio.Atualizar(_notaFiscal); _notaFiscal.ID.Should().Be(notaFiscal.ID); }
public void NotaFiscal_InfraData_Inserir_ComValorNotaInvalido_EsperadoFalha() { _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); _notaFiscal.ValorTotalNota = 0; Action action = () => _notaFiscalRepositorio.Inserir(_notaFiscal); action.Should().Throw <ExcecaoValorTotalInvalido>(); }
public void NotaFiscal_InfraData_Atualizar_ComNaturezaOperacaoInvalida_EsperadoFalha() { _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); _notaFiscal.NaturezaOperacao = String.Empty; Action action = () => _notaFiscalRepositorio.Atualizar(_notaFiscal); action.Should().Throw <ExcecaoNaturezaOperacaoVazia>(); }
public void NotaFiscal_InfraData_Atualizar_ComContadorDeProdutosInvalido_EsperadoFalha() { _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); _notaFiscal.Produtos = new List <ProdutoNfe>(); Action action = () => _notaFiscalRepositorio.Atualizar(_notaFiscal); action.Should().Throw <ExcecaoProdutosVazio>(); }
public void Teste_InfraData_NotaFiscal_InserirNotaFiscalEmitida_EsperadoOk() { BaseSqlTeste.SemearBancoParaNotaFiscal(); _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); Action action = () => _notaFiscalRepositorio.InserirNotaFiscalEmitida(_notaFiscal); action.Should().NotThrow(); }
public void Teste_InfraData_NotaFiscal_VerificarExistenciaPorChave_EsperadoOk() { BaseSqlTeste.SemearBancoParaNotaFiscal(); _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); bool notaFiscal = _notaFiscalRepositorio.ValidarExistenciaPorChave(_notaFiscal.Chave); notaFiscal.Should().BeTrue(); }
public void NotaFiscal_Integracao_Inserir_EsperadoOK() { _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); _notaFiscal = _notaFiscalServico.Inserir(_notaFiscal); var notaFiscal = _notaFiscalServico.ObterPorId(_notaFiscal.ID); notaFiscal.ID.Should().Be(_notaFiscal.ID); }
public void NotaFiscal_Integracao_Atualizar_EsperadoOK() { _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); _notaFiscal = _notaFiscalServico.Atualizar(_notaFiscal); var notaFiscal = _notaFiscalServico.ObterPorId(_notaFiscal.ID); notaFiscal.NaturezaOperacao.Should().Be(_notaFiscal.NaturezaOperacao); }
public void NotaFiscal_Integracao_EmitirNota_EsperadoOK() { _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); var notasFiscais = _notaFiscalServico.EmitirNota(_notaFiscal); var buscar = _notaFiscalServico.ObterPorId(_notaFiscal.ID); buscar.Should().BeNull(); notasFiscais.Should().BeTrue(); }
public void Teste_InfraData_NotaFiscal_ObterPorChave_EsperadoOk() { BaseSqlTeste.SemearBancoParaNotaFiscal(); _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); NotaFiscal notaFiscal = _notaFiscalRepositorio.ObterPorChave(_notaFiscal.Chave); notaFiscal.Should().NotBeNull(); notaFiscal.Chave.Should().Be(_notaFiscal.Chave); }
public void NotaFiscal_InfraXml_EXportar_TransportadorPessoa_EsperadoOK() { _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscalTransportadorPessoa(); var caminho = Path.Combine(_caminho, _notaFiscal.Chave + ".xml"); _notaFiscalExportacao = new NotaFiscalXmlRepository(caminho); var emitido = _notaFiscalExportacao.Exportar(_notaFiscal); emitido.Should().Be(true); }
public void NotaFiscal_Integracao_Deletar_EsperadoOK() { _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); _notaFiscal = _notaFiscalServico.Inserir(_notaFiscal); var notaFiscal = _notaFiscalServico.Deletar(_notaFiscal.ID); var buscar = _notaFiscalServico.ObterPorId(_notaFiscal.ID); //buscar.Should().BeNull(); notaFiscal.Should().BeTrue(); }
public void SetUp() { _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); _mockNotaFiscal = new Mock <NotaFiscal>(); _mockNfeRepositorio = new Mock <IProdutoNFeRepositorio>(); _mockNotaFiscalRepositorio = new Mock <INotaFiscalRepositorio>(); _mockExportacaoXML = new Mock <INotaFiscalExportacao>(); _mockExportacaoPDF = new Mock <INotaFiscalExportacao>(); _mockEnderecoRepositorio = new Mock <IEnderecoRepositorio>(); _mockEmitenteRepositorio = new Mock <IEmitenteRepositorio>(); _mockDestinatarioRepositorio = new Mock <IDestinatarioRepositorio>(); _mockTransportadorRepositorio = new Mock <ITransportadorRepositorio>(); _random = new Random(); _notaFiscalServico = new NotaFiscalServico( _mockNotaFiscalRepositorio.Object, _mockExportacaoXML.Object, _mockExportacaoPDF.Object, _mockEnderecoRepositorio.Object, _mockEmitenteRepositorio.Object, _mockDestinatarioRepositorio.Object, _mockTransportadorRepositorio.Object, _mockNfeRepositorio.Object, _random); }
public void SetUp() { _notaFiscal = NotaFiscalObjetoMae.ObterValidoNotaFiscal(); _mockRandom = new Mock <Random>(); }