コード例 #1
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 });
 }
コード例 #2
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);
 }
コード例 #3
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]);
 }
コード例 #4
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]);
 }