コード例 #1
0
 public void CanSetNextBoard()
 {
     DynamicBoard board = new DynamicBoard();
     board.NextBoard = new bool[,] { { true, false, true }, { false, false, false } };
     int[] dimensions = new int[] { board.NextBoard.GetLength(0), board.NextBoard.GetLength(1) };
     CollectionAssert.AreEqual(dimensions, new int[] { 2, 3 });
 }
コード例 #2
0
 public void BoardGrowsIfAliveOnEdges()
 {
     DynamicBoard board = new DynamicBoard();
     board.CurrentBoard = new bool[,] { { false, true, false }, { false, true, false }, { false, false, false } };
     board.Tick();
     int[] expected = new int[] { board.NextBoard.GetLength(0), board.NextBoard.GetLength(1) };
     CollectionAssert.AreEqual(expected, new int[] {5, 5 });
 }
コード例 #3
0
 public void AddsDeadCellsWhenBoardGrows()
 {
     DynamicBoard board = new DynamicBoard();
     board.CurrentBoard = new bool[,] { { false, true, false }, { false, true, false }, { false, false, false } };
     board.Tick();
     bool expected = board.NextBoard[4, 0];
     Assert.IsFalse(expected);
 }
コード例 #4
0
 public void CellsConvertToList()
 {
     DynamicBoard board = new DynamicBoard();
     board.CurrentBoard = new bool[,] { { false, false, false }, { false, true, false }, { false, false, false } };
     board.Tick();
     List<List<bool>> actual = new List<List<bool>>();
     actual.Add(new List<bool> { false, false, false });
     actual.Add(new List<bool> { false, true, false });
     actual.Add(new List<bool> { false, false, false });
     List<List<bool>> expectedCells = board.cells;
     Assert.AreEqual(expectedCells[1][0], actual[1][0]);
 }
コード例 #5
0
 public void CellsChangeOnTick()
 {
     DynamicBoard board = new DynamicBoard();
     board.CurrentBoard = new bool[,] { { false, true, false }, { true, true, false }, { false, false, false } };
     board.Tick();
     Assert.IsTrue(board.NextBoard[1, 1]);
 }
コード例 #6
0
 public void GetsSpecificLocationOnBoard()
 {
     DynamicBoard board = new DynamicBoard();
     board.CurrentBoard = new bool[,] { { true, false, true }, { false, false, false } };
     bool expected = board.CurrentBoard[0, 0];
     Assert.IsTrue(expected);
 }
コード例 #7
0
 public void CorrectlyCountsNeighbors()
 {
     DynamicBoard board = new DynamicBoard();
     board.NextBoard = new bool[,] { { true, false, true }, { false, false, false } };
     int expected = board.CountsNeighbors(0, 1); // Method runs on NextBoard
     Assert.AreEqual(expected, 2);
 }