public void ExcelReader_WithSingleCellSelection_GetsTable()
        {
            var selection = new Selection { StartColumn = 1, StartRow = 1, ColumnCount = 1, RowCount = 1 };

              var table = _sut.GetExcelTable(_worksheet, selection);

              Assert.That(table.SheetName, Is.EqualTo("WorksheetName"));
              Assert.That(table.Rows.Count, Is.EqualTo(1));
              Assert.That(table.Rows[0].Columns.Count, Is.EqualTo(1));
              Assert.That(table.Rows[0].Columns[0].Text, Is.EqualTo("1 1"));
        }
 public Table GetExcelTable(IWorksheet worksheet, Selection selection)
 {
     Table table = new Table(worksheet.Name, selection.ColumnCount, selection.RowCount);
       int rowOffset = selection.StartRow;
       int columnOffset = selection.StartColumn;
       for (int i = 0; i < selection.RowCount; i++)
       {
     for (int j = 0; j < selection.ColumnCount; j++)
     {
       var excelCell = worksheet.Cells[i + rowOffset, j + columnOffset];
       table.Rows[i].Columns[j] = ExtractExcelCellProperty(excelCell);
     }
       }
       return table;
 }
        public void ExcelReader_WithFullWorksheetRangeSelection_GetsTable()
        {
            var selection = new Selection {StartColumn = 1, StartRow = 1, ColumnCount = 4, RowCount = 3};

              var table = _sut.GetExcelTable(_worksheet, selection);

              Assert.That(table.SheetName, Is.EqualTo("WorksheetName"));
              Assert.That(table.Rows.Count, Is.EqualTo(3));

              for (int i = 0; i < selection.RowCount; i++)
              {
            Assert.That(table.Rows[i].Columns.Count, Is.EqualTo(4));
            for (int j = 0; j < selection.ColumnCount; j++)
            {
              Assert.That(table.Rows[i].Columns[j].Text, Is.EqualTo(string.Format("{0} {1}", i + 1, j + 1)));
            }
              }
        }