Beispiel #1
0
        public static void Calc(Stream stream, Action <ExcelPackage> assertAction)
        {
            var importer = new ConstructionImport(stream);

            importer.Import();

            using (var excel = new ExcelPackage(stream))
            {
                ProcessInExcel(excel);
                assertAction?.Invoke(excel);
            }
        }
Beispiel #2
0
        public static void CalcAndExportExcel(string fileName)
        {
            var originalFileName = fileName;
            var savingFileName   = Path.Combine(Path.GetDirectoryName(fileName),
                                                Path.GetFileName(fileName).Replace(".xlsx", "") + "_Processed.xlsx");

            var importer = new ConstructionImport(originalFileName);

            importer.Import();

            using (var excel = new ExcelPackage(new FileInfo(originalFileName)))
            {
                ProcessInExcel(excel);
                excel.SaveAs(new FileInfo(savingFileName));
            }
        }
 public void Construction()
 {
     BusinessValue();
     BusinessFeatureImport();
     ConstructionValue();
     ImportAndValidate("Construction.xlsx", stream =>
     {
         var importer = new ConstructionImport(stream);
         importer.Import();
         var data = Context.Constructions.First();
         Assert.AreEqual(1, data.ConstructionValueId);
         Assert.AreEqual(201, data.BusinessFeatureId);
         Assert.AreEqual(7, data.Ds);
         //todo fix all asserts
         Assert.AreEqual(importer.RowCount, 4);
         Assert.AreEqual(Context.Constructions.Count(), 3);
     });
 }