public void CarregarLancamento() { string fileName = @"C:\31160541706664000239550010000055791001365074-nfe.xml"; var nfe = XElement.Load(fileName); var nfeCarregada = Serializer.Deserialize<TNfeProc>(nfe); var infNFe = nfeCarregada.NFe.infNFe.dest; var inf = nfeCarregada.NFe.infNFe.ide; var total = nfeCarregada.NFe.infNFe.total; var testeLancamento = new Lancamento(); testeLancamento.numeroNFe = 5579; testeLancamento.dataEmissao = Convert.ToDateTime("2016-05-09T10:31:08-02:00"); testeLancamento.dataLancamento = DateTime.Now; testeLancamento.tipoLancamento = "Saída"; testeLancamento.cnpj = "05595636000147"; testeLancamento.razaoSocial = "ASSOCIACAO DOS MORADORES DO RETIRO DAS SERRAS"; testeLancamento.valorTotal = Convert.ToDecimal(52.60); lancamento.numeroNFe = Convert.ToInt32(inf.nNF); lancamento.dataEmissao = Convert.ToDateTime(inf.dhEmi); lancamento.dataLancamento = DateTime.Now; lancamento.tipoLancamento = "Saída"; lancamento.razaoSocial = infNFe.xNome; lancamento.cnpj = infNFe.Item; var strTotatl = total.ICMSTot.vNF; lancamento.valorTotal = Convert.ToDecimal(strTotatl.Replace(".", ",")); Assert.AreEqual(lancamento.numeroNFe, testeLancamento.numeroNFe); Assert.AreEqual(lancamento.dataEmissao, testeLancamento.dataEmissao); Assert.AreEqual(lancamento.cnpj, testeLancamento.cnpj); Assert.AreEqual(lancamento.razaoSocial, testeLancamento.razaoSocial); Assert.AreEqual(lancamento.valorTotal, testeLancamento.valorTotal); Assert.AreEqual(lancamento.dataLancamento, testeLancamento.dataLancamento); Assert.AreEqual(lancamento.tipoLancamento, testeLancamento.tipoLancamento); }
public CarregarXMLNFe() { lancamento = new Lancamento(); produto = new Produto(); lancamentoProduto = new LancamentoProduto(); }