public void InitializationStrategyForHardGame()
        {
            var settings = new HardBoardSettings();
            var subscribers = new List<IBoardObserver>()
            {
            };
            var board = new Board(settings, subscribers);

            var strategy = new StandardGameInitializationStrategy(new ContentFactory());

            IBoard newBoard = strategy.Initialize(board);
            int bombCount = 0;
            for (int i = 0; i < GlobalConstants.ExpertLevelNumberOfBoardRows; i++)
            {
                for (int j = 0; j < GlobalConstants.ExpertLevelNumberOfBoardCols; j++)
                {
                    if (newBoard.Cells[i, j].Content.Value == -1)
                    {
                        bombCount++;
                    }
                }
            }

            Assert.AreEqual(newBoard.Rows, GlobalConstants.ExpertLevelNumberOfBoardRows);
            Assert.AreEqual(newBoard.Cols, GlobalConstants.ExpertLevelNumberOfBoardCols);
            Assert.AreEqual(bombCount, GlobalConstants.ExpertLevelNumberOfBoardBombs);
        }
コード例 #2
0
        public void NoExceptionIsTrownByRenderBoard()
        {
            AllocConsole();
            var renderer = new ConsoleRenderer();

            var settings = new EasyBoardSettings();
            var subscribers = new List<IBoardObserver>()
            {
            };
            var board = new Board(settings, subscribers);

            var strategy = new StandardGameInitializationStrategy(new ContentFactory());

            var newBoard = strategy.Initialize(board);

            renderer.RenderBoard(board, board.Cols, board.Rows);
        }