public void CreateSubtable_DataFilledTable_HasEntries() { var table = new Table<int>(); for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) table[i, j] = i + j; var subTable = table.CreateSubtable(new TableIndex(1, 1), new TableIndex(3, 3)); Assert.AreEqual(1 + 1, subTable[0, 0]); Assert.AreEqual(1 + 2, subTable[0, 1]); Assert.AreEqual(2 + 1, subTable[1, 0]); Assert.AreEqual(2 + 2, subTable[1, 1]); }
private void ValidateComponentsDrawn(Table<SelectableGraphicComponentMock> components, TableIndex startIndex, TableIndex endIndex) { var drawnArea = components.CreateSubtable(startIndex, endIndex); foreach (var c in components) Assert.AreEqual(drawnArea.Contains(c), c.WasDrawn); }
public void CreateSubtable_WithValidIndexes_RightNumberOfRowsAndColumns() { var table = new Table<Object>(); table[5, 5] = new Object(); var subTable = table.CreateSubtable(new TableIndex(1, 1), new TableIndex(3, 3)); Assert.AreEqual(2, subTable.Rows); Assert.AreEqual(2, subTable.Columns); }