예제 #1
0
        public void VerifyThatAGridCanTransformItselfIntoADataSet()
        {
            Grid grid = new Grid(new int[,]{{1, 5},
                                            {2, 6},
                                            {3, 7},
                                            {4, 8}});
            Assert.That(grid.Width == 2);
            Assert.That(grid.Height == 4);

            DataSet dataSet = grid.ToDataSet();
            Assert.That((int)dataSet.Tables[0].Rows[0][0] == 1);
            Assert.That((int)dataSet.Tables[0].Rows[0][1] == 5);
            Assert.That((int)dataSet.Tables[0].Rows[1][0] == 2);
            Assert.That((int)dataSet.Tables[0].Rows[1][1] == 6);
            Assert.That((int)dataSet.Tables[0].Rows[2][0] == 3);
            Assert.That((int)dataSet.Tables[0].Rows[2][1] == 7);
            Assert.That((int)dataSet.Tables[0].Rows[3][0] == 4);
            Assert.That((int)dataSet.Tables[0].Rows[3][1] == 8);
        }
 private void PaintGridAndPathOnUi(Grid grid, PathResults pathDetails)
 {
     this.dataGridView1.DataSource = grid.ToDataSet().Tables[0];
     this.DisplayPathResults(pathDetails);
     this.HighlightPath(grid.Width, pathDetails);
 }