Esempio n. 1
0
        public void ShouldThrowIfPlayIsCalledBeforeBoardCreated()
        {
            gameOfLifeRuleMock.Setup(x => x.LifeStatusForNextTick(It.IsAny <DeadOrAliveNeighboursCount>(), It.IsAny <LifeStatus>())).Returns(LifeStatus.Alive);

            var gol = new GameOfLifeBoard(gameOfLifeRuleMock.Object);

            Assert.Throws <BoardNotCreatedException>(() => gol.PlayGame(1, It.IsAny <Action <LifeStatus[, ]> >()));
        }
Esempio n. 2
0
        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);
        }