public void GetAnswerShouldCallConsoleMethodReadLineOnceWithValidInput()
        {
            var mockConsole = new Mock<IConsoleReader>();
            var reader = mockConsole.Object;
            var writer = new ConsoleWriter();

            mockConsole.Setup(c => c.ReadLine()).Returns("yes");
            var inputHandler = new ConsoleInputHandler(writer, reader);
            inputHandler.GetPlayAgainResponse();

            mockConsole.Verify(c => c.ReadLine(), Times.Exactly(1));
        }
        public void GetGameModeShuldCallConsoleMethodReadLineOnceWithValidInputFly()
        {
            var mockConsole = new Mock<IConsoleReader>();
            var reader = mockConsole.Object;
            var writer = new ConsoleWriter();

            mockConsole.Setup(c => c.ReadLine()).Returns("fly");
            var inputHandler = new ConsoleInputHandler(writer, reader);
            inputHandler.GetGameMode();

            mockConsole.Verify(c => c.ReadLine(), Times.Exactly(1));
        }
        /// <summary>
        /// This method instantiate all dependencies for the game.
        /// </summary>
        public static void StartGame()
        {
            // Console context dependancies
            IConsoleWriter consoleWriter = new ConsoleWriter();
            IConsoleReader consoleReader = new ConsoleReader();

            // Instantiate game dependancies
            IRenderer renderer = new ConsoleRenderer(consoleWriter);
            IInputHandler inputHandler = new ConsoleInputHandler(consoleWriter, consoleReader);
            IFieldFactory fieldFactory = new GameFieldFactory();
            IFieldMemoryManager fieldMemoryManager = new FieldMemoryManager();
            IBalloonsFactory balloonsFactory = new BalloonsFactory();
            IFiller matrixFiller = new Filler(balloonsFactory);
            ICommandManager commandManager = new CommandManager();

            // Printing initial screen goes here.
            renderer.RenderGameMessage(GameMessages.InitialGameMessage);
            renderer.RenderCommands(GameMessages.CommandsMessages);

            // Getting mode and difficulty goes here.
            GameMode gameMode = inputHandler.GetGameMode();
            GameDifficulty gameDifficulty = inputHandler.GetGameDifficulty();

            var reorderStrategy = GetReorderStrategy(gameMode);

            // Fluent interface implementation
            IBalloonsEngine engine = new BalloonsGameEngine()
                .Renderer(renderer)
                .Input(inputHandler)
                .FieldFactory(fieldFactory)
                .FieldMemoryManager(fieldMemoryManager)
                .BalloonsFactory(balloonsFactory)
                .CommandManager(commandManager)
                .ReorderBalloonsStrategy(reorderStrategy)
                .GameFieldFiller(matrixFiller);

            engine.InitializeGame(gameDifficulty);
            engine.StartGame();
        }