public void GameFieldHavingCellsWithNumbersIsNotReordered()
        {
            var strategy = new ReorderBalloonsStrategyFly();
            var field = new GameField(2, 2);
            field[0, 0] = new BalloonOne();
            field[0, 1] = new BalloonTwo();
            field[1, 0] = new BalloonThree();
            field[1, 1] = new BalloonFour();

            strategy.ReorderBalloons(field);
            var isChanged = false;
            int nextSymbol = 0;

            for (int i = 0; i < field.Rows; i++)
            {
                for (int j = 0; j < field.Columns; j++)
                {
                    nextSymbol++;
                    if (field[i, j].Symbol != nextSymbol.ToString())
                    {
                        isChanged = true;
                    }
                }
            }

            Assert.IsFalse(isChanged);
        }
 public void PopBallonsCommandThrowWithNegativeInput()
 {
     Setup();
     var originalField = new GameField(2, 2);
     originalField[0, 0] = new BalloonOne();
     originalField[0, 1] = new BalloonTwo();
     originalField[1, 0] = new BalloonThree();
     originalField[1, 1] = new BalloonFour();
     var popC = new PopBalloonsCommand(this.balloonsFactory, this.field, -2, -2);
     popC.Execute();
 }
        public void PopBallonsCommandShouldWorkProperlyWithValidInput()
        {
            Setup();
            var originalField = new GameField(2, 2);
            originalField[0, 0] = new BalloonOne();
            originalField[0, 1] = new BalloonTwo();
            originalField[1, 0] = new BalloonThree();
            originalField[1, 1] = new BalloonFour();
            var popC = new PopBalloonsCommand(this.balloonsFactory, this.field, 1, 1);
            popC.Execute();

            Assert.AreNotEqual(field, originalField);
        }
        public void TwoDimensionalGameFieldWithFirstCellHavingSymbolDotIsMovedAtBottom()
        {
            var strategy = new ReorderBalloonsStrategyFly();
            var field = new GameField(2, 2);
            field[0, 0] = new BalloonPoped();
            field[0, 1] = new BalloonTwo();
            field[1, 0] = new BalloonThree();
            field[1, 1] = new BalloonFour();

            strategy.ReorderBalloons(field);

            Assert.IsInstanceOfType(field[1, 0], typeof(BalloonPoped));
        }
        /// <summary>
        /// Method for taking Balloons, if the Balloon is already in the dictionary, it's not added again
        /// </summary>
        public Balloon GetBalloon(string symbol)
        {
            if (this.balloons.ContainsKey(symbol))
            {
                return this.balloons[symbol];
            }

            Balloon balloon;
            switch (symbol)
            {
                case "1":
                    {
                        balloon = new BalloonOne();
                        break;
                    }

                case "2":
                    {
                        balloon = new BalloonTwo();
                        break;
                    }

                case "3":
                    {
                        balloon = new BalloonThree();
                        break;
                    }

                case "4":
                    {
                        balloon = new BalloonFour();
                        break;
                    }

                case ".":
                    {
                        balloon = new BalloonPoped();
                        break;
                    }

                default:
                    {
                        throw new ArgumentException(string.Format(BalloonSymbolErrorMessage, symbol));
                    }
            }

            this.balloons.Add(symbol, balloon);

            return balloon;
        }