Exemplo n.º 1
0
        public async Task <IList <ImportResult> > PerformImport()
        {
            IList <ImportResult> results = new List <ImportResult>();

            //clean the files
            await CleanEnvironment();

            //Download the zipfile
            FileDownloadResult downloadResult =
                await FileDownloadUtilities.DownloadFile(new Uri(Path.Combine(CsvImportSettings.FtpSource, CsvImportSettings.FacZipFilename)),
                                                         CsvImportSettings.LocalImportDirectory);

            if (downloadResult.Success)
            {
                ZipUtility.UnZipFile(downloadResult.LocalFilePath, downloadResult.TargetDirectory);

                results.Add(await PassthroughImporter.Import());
                results.Add(await FormattedFindingsTextImporter.Import());
                results.Add(await FormattedCapTextImporter.Import());
                results.Add(await FindingTextImporter.Import());
                results.Add(await FindingImporter.Import());
                results.Add(await EinImporter.Import());
                results.Add(await DunImporter.Import());
                results.Add(await CpaImporter.Import());
                results.Add(await CapTextImporter.Import());
                results.Add(await AgencyImporter.Import());
                results.Add(await GeneralImporter.Import());
                results.Add(await CfdaImporter.Import());
            }

            return(results);
        }
Exemplo n.º 2
0
        public async Task TestUnzip()
        {
            //Download a "real life" test file
            IFileDownloadUtilities du = new FileDownloadUtilities();
            await du.DownloadFile(ZipFileUrl, TargetDirectory);

            Assert.IsTrue(File.Exists(Path.Combine(TargetDirectory, ZipFileName)));

            IZipUtility zu = new ZipUtility();

            zu.UnZipFile(Path.Combine(TargetDirectory, ZipFileName), TargetDirectory);

            Assert.IsTrue(File.Exists(Path.Combine(TargetDirectory, UnzippedFilename)));
        }