示例#1
0
 public void Game_Is_Initialised_With_Random_State()
 {
     _logger.WriteLine(_game.CountAlive().ToString());
     _logger.WriteLine(_game.CountDead().ToString());
     Assert.True(_game.CountAlive() >= 1);
     Assert.True(_game.CountAlive() <= 50);
 }
示例#2
0
        public void When_Cell_Has_Two_Living_Neighbour_Cell_Stays_Alive()
        {
            var initialBoard = new int[10, 10];

            initialBoard[5, 5] = 1;
            initialBoard[5, 6] = 1;
            initialBoard[6, 6] = 1;

            var game     = new GameOfLife(initialBoard);
            var newBoard = game.Tick();

            Assert.Equal(1, newBoard[5, 5]);
            Assert.Equal(1, newBoard[5, 6]);
            Assert.Equal(1, newBoard[6, 6]);
            Assert.Equal(3, game.CountAlive());
        }