예제 #1
0
파일: Form1.cs 프로젝트: haoruizh/CS321
        /// <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);
            }
        }
예제 #2
0
        public void TestSpreadsheetColumnCountZero()
        {
            Spreadsheet s = new Spreadsheet(5, 0);

            Assert.That(s.ColumnCount(), Is.EqualTo(0), "Spreadsheet returned unexpected column count.");
        }
예제 #3
0
        public void TestSpreadsheetColumnCountNormal()
        {
            Spreadsheet s = new Spreadsheet(6, 5);

            Assert.That(s.ColumnCount(), Is.EqualTo(5), "Spreadsheet returned unexpected column count.");
        }