public void CreateGroupsDoubleTargetPlayers() { var players = new Player[] { new Player(), new Player(), new Player(), new Player(), new Player(), new Player(), new Player(), new Player() }; var startTournament = new TournamentGeneratorMock(); List <Group> actualGroups = startTournament.CreateGroups(_dataStore, players, 0); Assert.AreEqual(2, actualGroups.Count, "The number of groups created were not correct."); Assert.AreEqual(4, actualGroups[0].playersInGroup.Count, "The size of the group created was not correct."); }
public void CreateGamesFromGroupOfFive() { var players = new Group(); var playersInGroup = new List <Player>() { new Player() { id = 1 }, new Player() { id = 2 }, new Player() { id = 3 }, new Player() { id = 4 }, new Player() { id = 5 } }; players.playersInGroup = playersInGroup; var startTournament = new TournamentGeneratorMock(); var games = startTournament.CreateGamesFromGroup(players); int expectedNumberOfGames = CalculateExpectedNumberOfGames(players.playersInGroup); var playerIdsPlayed = CalculatePlayersPlayedAgainst(players.playersInGroup, games); Assert.AreEqual(expectedNumberOfGames, games.Count, "The correct number of games was not generated!"); foreach (Player player in players.playersInGroup) { foreach (Player playerToCompare in players.playersInGroup) { if (player.id == playerToCompare.id) { continue; } Assert.IsTrue(playerIdsPlayed.Contains(playerToCompare.id), "Player id " + player.id + " did not play id " + playerToCompare.id); } } }