public void GameOverTest() { for (int tests = 0; tests < 1; tests++) { for (int i = 3; i < 15; i = i + 3) { List<Player> players = TestX.GenListOfPlayers(i); Game game = new Game(gameSystem.GetNextGameId(), players[0]); for (int j = 1; j < players.Count; j++) { game.AddPlayer(players[j]); } Assert.IsTrue(game.Start()); while (!game.IsGameOver()) { KillNextPlayer(players); } } } }
public void GameGenerationTest() { for (int tests = 0; tests < 100; tests++) { for (int i = 3; i < 25; i = i + 3) { List<Player> players = TestX.GenListOfPlayers(i); Game game = new Game(gameSystem.GetNextGameId(), players[0]); Assert.IsTrue(validateTeamComposition(game)); for (int j = 1; j < players.Count; j++) { game.AddPlayer(players[j]); } List<Type> roleTypes = gameSystem.GetRoleTypes(); game.Start(); Assert.IsTrue(ValidateRoleMaxPercentage(game)); Assert.IsTrue(ValidateTeamMinPercent(game)); } } }
/// <summary> /// Join game request is valid, process it. /// </summary> /// <param name="player"></param> /// <param name="action"></param> /// <param name="game"></param> private void ProcessJoinAction(Player player, Action action, Game game) { game.AddPlayer(player); Gmail.MessagePlayer(player, game, "Successfully added you to the game, <b>" + game.Overlord + "</b> is the Overlord.<br />" + "I will notify you when the game has started." + "<br /><br />" + game.Help(player)); Gmail.MessagePlayer(game.Overlord, game, "<b>" + player + "</b> has joined " + game.Title); gameLog.Info("Added player " + player + " to " + game); }