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)); }
public void TwoDimensionalGameFieldWithThirdCellHavingSymbolDotIsMovedAtTop() { var strategy = new ReorderBalloonsStrategyDefault(); var field = new GameField(2, 2); field[0, 0] = new BalloonOne(); field[0, 1] = new BalloonTwo(); field[1, 0] = new BalloonPoped(); field[1, 1] = new BalloonFour(); strategy.ReorderBalloons(field); Assert.IsInstanceOfType(field[0, 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; }