/// <summary> /// pick 50 random cells from spreadsheet and change their text to "HelloWorld" /// Display the grid view /// </summary> private void randomCellTextChange() { Random randomRow = new Random(); Random randomCol = new Random(); int currentRow = 0; int currentCol = 0; int randomCellCount = 0; newSheet.RowCount(); newSheet.ColumnCount(); for (randomCellCount = 0; randomCellCount <= 50; ++randomCellCount) { currentRow = randomRow.Next(1, newSheet.RowCount()); currentCol = randomCol.Next(1, newSheet.ColumnCount()); newSheet.Get_Cell(currentRow, currentCol).Text = "HelloWorld"; string newValue = this.newSheet.Get_Cell(currentRow, currentCol).Value; this.dataGridView1.Rows[currentRow].Cells[currentCol].Value = GetValue(currentRow, currentCol); } }
public void TestSpreadsheetColumnCountZero() { Spreadsheet s = new Spreadsheet(5, 0); Assert.That(s.ColumnCount(), Is.EqualTo(0), "Spreadsheet returned unexpected column count."); }
public void TestSpreadsheetColumnCountNormal() { Spreadsheet s = new Spreadsheet(6, 5); Assert.That(s.ColumnCount(), Is.EqualTo(5), "Spreadsheet returned unexpected column count."); }