public void Calculate_SpreadsheetWithoutCellReferences_AllCellsCalculated() { _spreadsheet.SetSize(2, 3); for (var row = 1; row <= _spreadsheet.RowsCount; row++) { for (var col = 1; col <= _spreadsheet.ColumnsCount; col++) { _spreadsheet.SetValue(col, row, $"{col} + {row}"); } } _spreadsheet.Calculate(); for (var row = 1; row <= _spreadsheet.RowsCount; row++) { for (var col = 1; col <= _spreadsheet.ColumnsCount; col++) { var cell = _spreadsheet.GetValue(col, row); Assert.Equal(col + row, int.Parse(cell.ResultValue)); } } }
public void GetCell_CellIsOutOfSpreadsheetBoundaries_ThrowIndexOutOfRangeException(int columnNumber, int rowNumber) { _spreadsheet.SetSize(1, 1); Assert.Throws <IndexOutOfRangeException>(() => _spreadsheet.GetValue(rowNumber, columnNumber)); }