public void ProcessCommandPopWithNegativesRowAndColInputShouldReturnPopCommand()
        {
            Setup();
            var commandManager = new CommandManager();
            var invalidPop = commandManager.ProcessCommand(invalidCommands[6], this.renderer, this.field, this.fieldMemoryManager, this.balloonsFactory);

            Assert.IsInstanceOfType(invalidPop, typeof(PopBalloonsCommand));
        }
        /// <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();
        }
 public void ProcessCommandWithInvalidStringInputShouldThrow()
 {
     Setup();
     var commandManager = new CommandManager();
     var invalid = commandManager.ProcessCommand(invalidCommands[2], this.renderer, this.field, this.fieldMemoryManager, this.balloonsFactory);
 }
 public void ProcessCommandPopInputWithoutRowAndColShouldShouldReturnPopCommand()
 {
     Setup();
     var commandManager = new CommandManager();
     var invalid = commandManager.ProcessCommand(invalidCommands[4], this.renderer, this.field, this.fieldMemoryManager, this.balloonsFactory);
 }
        public void ProcessCommandWithValidTopInputShouldProduceATopCommand()
        {
            Setup();
            var commandManager = new CommandManager();
            var top = commandManager.ProcessCommand(validCommands[4], this.renderer, this.field, this.fieldMemoryManager, this.balloonsFactory);

            Assert.IsInstanceOfType(top, typeof(TopScoresCommand));
        }
        public void ProcessCommandWithValidSaveInputShouldProduceASaveCommand()
        {
            Setup();
            var commandManager = new CommandManager();
            var save = commandManager.ProcessCommand(validCommands[2], this.renderer, this.field, this.fieldMemoryManager, this.balloonsFactory);

            Assert.IsInstanceOfType(save, typeof(SaveCommand));
        }
        public void ProcessCommandWithValidHelpInputShouldProduceAHelpCommand()
        {
            Setup();
            var commandManager = new CommandManager();
            var help = commandManager.ProcessCommand(validCommands[1], this.renderer, this.field, this.fieldMemoryManager, this.balloonsFactory);

            Assert.IsInstanceOfType(help, typeof(HelpCommand));
        }
        public void ProcessCommandWithValidExitInputShouldProduceAExitCommand()
        {
            Setup();
            var commandManager = new CommandManager();
            var exit = commandManager.ProcessCommand(validCommands[0], this.renderer, this.field, this.fieldMemoryManager, this.balloonsFactory);

            Assert.IsInstanceOfType(exit, typeof(ExitCommand));
        }