public void NotaContingenciaEnviadaXmlValidoTest() { var notaFiscalService = new NotaFiscalService(); notaFiscalService.AtivarModoOffline("Teste unitário envio contingência", DateTime.Now); NotaFiscal notaFiscal; ConfiguracaoEntity config; EnviarNotaTesteUnitarioUtils.EnviarNotaFiscal(out notaFiscal, out config); Task task = new Task(() => notaFiscalService.AtivarModoOnline()); task.RunSynchronously(); task.Wait(); //verificar se arquivo existe var notaTest = new NotaFiscalService().GetNotaFiscalByChave(notaFiscal.Identificacao.Chave, Ambiente.Homologacao); string xml = notaTest.LoadXml(); Assert.IsFalse(string.IsNullOrWhiteSpace(xml)); Assert.IsTrue(File.Exists(notaTest.XmlPath)); Assert.IsTrue(notaTest.Status == (int)NFe.Repository.Status.ENVIADA); ValidadorXml.ValidarXml(xml, "procNFe_v4.00.xsd"); }