Exemplo n.º 1
0
        public async Task ScrapedStartEndDates()
        {
            var store        = new InMemoryKVStore();
            var invoiceStore = new SBCScan.InvoiceStore(store);

            await invoiceStore.Post(CreateInvoiceFull(new DateTime(2017, 1, 1), "Supplier"));

            var alreadyScraped = await invoiceStore.GetKeysParsed();

            var mf  = new SBCScan.MediusFlow(store, null);
            var tmp = await mf.GetStartEndDates(alreadyScraped, null, null, false);
        }
Exemplo n.º 2
0
        private async Task <(int[], List <InvoiceFull>, List <RootRecord>, List <Invoice>, List <Receipt>, List <BankTransaction>)> Prepare(int[] years)
        {
            var store = new FileSystemKVStore(Tools.GetOutputFolder());

            var invoiceStore = new SBCScan.InvoiceStore(store);
            var files        = await invoiceStore.GetKeysParsed();

            var invoices = (await Task.WhenAll(files.Where(o => years.Contains(o.RegisteredDate.Year)).Select(async o => await invoiceStore.Get(o)).ToList())).ToList();


            var sieFolder = Tools.GetOutputFolder("SIE");
            var sieFiles  = new DirectoryInfo(sieFolder).GetFiles($"output_*.se").Select(o => o.Name).Where(o => years.Any(p => o.Contains(p.ToString())));
            var sie       = await SBCExtensions.ReadSIEFiles(sieFiles.Select(file => Tools.GetOutputFolder("SIE", file)));

            var dir             = Tools.GetOutputFolder("sbc_html");
            var sbcInvoices     = new InvoiceSource().ReadAll(dir).Where(o => years.Contains(o.RegisteredDate.Year)).ToList();
            var sbcReceipts     = new ReceiptsSource().ReadAll(dir).Where(o => years.Contains(o.Date.Year)).ToList();
            var sbcTransactions = new BankTransactionSource().ReadAll(dir).Where(o => years.Contains(o.CurrencyDate.Year)).ToList();

            return(years, invoices, sie.ToList(), sbcInvoices, sbcReceipts, sbcTransactions);
        }
Exemplo n.º 3
0
        public async Task MyTestMethod()
        {
            var store = new FileSystemKVStore(Tools.GetOutputFolder());

            var invoiceStore   = new SBCScan.InvoiceStore(store);
            var alreadyScraped = await invoiceStore.GetKeysParsed();

            var errors = new Dictionary <InvoiceFull.FilenameFormat, Exception>();

            foreach (var item in alreadyScraped)
            {
                try
                {
                    await invoiceStore.Get(item);
                }
                catch (Exception ex)
                {
                    errors.Add(item, ex);
                }
            }
            Assert.IsFalse(errors.Any());
        }