public void InitializeSetsRightTopCellAsNeighbor() { Cell cellToTest = new Cell(GameOfLifeCellState.Dead); Cell rightTopNeighbor = new Cell(GameOfLifeCellState.Alive); var board = new Board(2, 2, new[] { new[] { new Cell(GameOfLifeCellState.Dead), rightTopNeighbor }, new[] { cellToTest, new Cell(GameOfLifeCellState.Alive), } }); var initializer = new BoundedNeighborshipInitializer(); initializer.Initialize(board); Assert.IsTrue(cellToTest.Neighbors.Contains(rightTopNeighbor)); }
public void InitializeSetsLeftBottomCellAsNeighbor() { Cell cellToTest = new Cell(GameOfLifeCellState.Dead); Cell leftBottomNeighbor = new Cell(GameOfLifeCellState.Alive); var board = new Board(2, 2, new[] { new[] { new Cell(GameOfLifeCellState.Dead), cellToTest, }, new[] { leftBottomNeighbor, new Cell(GameOfLifeCellState.Alive), } }); var initializer = new BoundedNeighborshipInitializer(); initializer.Initialize(board); Assert.IsTrue(cellToTest.Neighbors.Contains(leftBottomNeighbor)); }
public void InitializeSetsLeftCellAsNeighbor() { Cell cellToTest = new Cell(GameOfLifeCellState.Dead); Cell leftNeighbor = new Cell(GameOfLifeCellState.Alive); var board = new Board(1, 2, new[] { new[] { leftNeighbor, cellToTest } }); var initializer = new BoundedNeighborshipInitializer(); initializer.Initialize(board); Assert.AreEqual(1, cellToTest.Neighbors.Count); Assert.AreSame(leftNeighbor, cellToTest.Neighbors[0]); }