Esempio n. 1
0
        public void Indexer_ValidRowAndColumn_ReturnsCellValue()
        {
            // Arrange:
            var sheet      = MockedSheetFactory.HeaderTestCases(5, 5).Cast <TestCaseData>().First().Arguments[0] as ISheet;
            var sheetTable = new SheetTable(sheet);

            // Action:
            var res = sheetTable[2, 2];

            // Assert:
            Assert.That(res, Is.Not.Null);
            Assert.That(res.GetType().IsAssignableFrom(typeof(CellValue)));
        }
Esempio n. 2
0
        public void Indexer_SheetTableContainsOnlyHeaders_Throws()
        {
            // Arrange:
            var sheet      = MockedSheetFactory.HeaderTestCases(5, 5).Cast <TestCaseData>().Where(tc => tc.TestName.Contains("#8"))?.First().Arguments[0] as ISheet;
            var sheetTable = new SheetTable(sheet);

            // Action:
            var ex = Assert.Catch <InvalidOperationException>(() =>
            {
                var res = sheetTable[0, 0];
            });

            // Assert:
            StringAssert.Contains("Sheet has only headers.", ex.Message);
        }
Esempio n. 3
0
        public void Indexer_ColumnOutOfRange_Throws()
        {
            // Arrange:
            var sheet      = MockedSheetFactory.HeaderTestCases(5, 5).Cast <TestCaseData>().First().Arguments[0] as ISheet;
            var sheetTable = new SheetTable(sheet);

            // Action:
            var ex = Assert.Catch <IndexOutOfRangeException>(() =>
            {
                var res = sheetTable[0, -1];
            });

            // Assert:
            StringAssert.Contains("Column was outside the bounds of sheet table.", ex.Message);
        }