private static IWorkbook LoadWorkbook(string path) { if (!ImportUtils.IsExcelFile(path)) { throw new ArgumentException($"Not an Excel file: {path}"); } IWorkbook workbook; using (var stream = File.Open(path, FileMode.Open, FileAccess.Read)) { workbook = new XSSFWorkbook(stream); } return(workbook); }
public void ShouldRecognizeExcelFiles(string filePath, bool expected) { var actual = ImportUtils.IsExcelFile(filePath); Assert.AreEqual(expected, actual); }