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 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> /// Depending the game mode value provides object representing the class having the needed logic. /// </summary> /// <param name="gameMode">The needed mode taken from the user.</param> /// <returns>Concrete instance of the mode.</returns> private static ReorderBalloonsStrategy GetReorderStrategy(GameMode gameMode) { ReorderBalloonsStrategy strategy; if (gameMode == GameMode.Fly) { strategy = new ReorderBalloonsStrategyFly(); } else { strategy = new ReorderBalloonsStrategyDefault(); } return strategy; }
public void PassingNullGameFieldShouldThrowException() { var strategy = new ReorderBalloonsStrategyFly(); strategy.ReorderBalloons(null); }