public void WhenNoColumnsAddedToTableYet_ThenReturnsRowWithNoColumns() { SimpleDataTable target = new SimpleDataTable(); IDataRow result = target.NewRow(); Assert.NotNull(result); Assert.Equal(0, target.ColumnNames.Count); Assert.Equal(0, result.ColumnNames.Count); }
public void WhenColumnsAddedToTable_ThenReturnsRowWithSameColumnsAsTable() { SimpleDataTable target = new SimpleDataTable(); target.ColumnNames.Add("Col1"); target.ColumnNames.Add("Col2"); IDataRow result = target.NewRow(); Assert.NotNull(result); Assert.Equal(2, target.ColumnNames.Count); Assert.Same(target.ColumnNames, result.ColumnNames); }
protected override void CreateTableAndAddSomeRows(int rowCount, int columnCount) { SimpleDataTable table = new SimpleDataTable(); for (int col = 0; col < columnCount; col++) { table.ColumnNames.Add("Column " + col); } for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) { IDataRow row = table.NewRow(); for (int colIndex = 0; colIndex < columnCount; colIndex++) { row[colIndex] = GetColValue(rowIndex, colIndex); } } }