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 }); }
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 }); }
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); }
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]); }
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]); }
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); }
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); }