public void ShouldThrowIfBoardIsBelowMinimumSize() { gameOfLifeRuleMock.Setup(x => x.LifeStatusForNextTick(It.IsAny <DeadOrAliveNeighboursCount>(), It.IsAny <LifeStatus>())).Returns(LifeStatus.Alive); var gol = new GameOfLifeBoard(gameOfLifeRuleMock.Object); Assert.Throws <InvalidBoardSizeException>(() => gol.CreateNewBoard(2, 2)); }
public void ShouldThrowErrorForInvalidSeedValues() { gameOfLifeRuleMock.Setup(x => x.LifeStatusForNextTick(It.IsAny <DeadOrAliveNeighboursCount>(), It.IsAny <LifeStatus>())).Returns(LifeStatus.Alive); var gol = new GameOfLifeBoard(gameOfLifeRuleMock.Object); gol.CreateNewBoard(4, 4); Assert.Throws <InvalidSeedException>(() => gol.Seed(new List <RowColumnLifeStatus>() { new RowColumnLifeStatus(-4, 4, LifeStatus.Alive) })); }
private static void SetupAndPlayGameOfLife(GameOfLifeBoard gol, int rows, int columns, int tickGenerations, List <RowColumnLifeStatus> seedList) { var boardVisualizer = new ConsoleBoardOutput(); gol.CreateNewBoard(rows, columns); if (seedList.Any()) { gol.Seed(seedList); } gol.PlayGame(tickGenerations, boardVisualizer.Output); }