public void NonExistingSheetIndexThrowsMeaningfulError() { var testFileLocation = TestHelper.TestsheetPath("TestSpreadsheet1.xlsx"); var lightWeightExcelReader = new ExcelReader(testFileLocation); LightweightExcelReaderSheetNotFoundException exception = null; try { var sheet = lightWeightExcelReader[999]; var test = sheet["A1"]; } catch (Exception e) { exception = e as LightweightExcelReaderSheetNotFoundException; } exception.Should().NotBe(null); exception.Message.Should().Be("Sheet with zero-based index 999 not found in the workbook. Workbook contains 10 sheets"); }
public void NonExistingSheetThrowsMeaningfulError() { var testFileLocation = TestHelper.TestsheetPath("TestSpreadsheet1.xlsx"); var lightWeightExcelReader = new ExcelReader(testFileLocation); LightweightExcelReaderSheetNotFoundException exception = null; try { var sheet = lightWeightExcelReader["ThisSheetDoesNotExist"]; var test = sheet["A1"]; } catch (Exception e) { exception = e as LightweightExcelReaderSheetNotFoundException; } exception.Should().NotBe(null); exception.Message.Should().Be("Sheet with name 'ThisSheetDoesNotExist' was not found in the workbook"); }