public List <Player> GetWinningPlayers(Dictionary <string, List <Card> > gameData) { PlayerUtils.ValidateGameData(gameData); List <Player> players = PlayerUtils.GeneratePlayers(gameData); List <Player> possibleWinners = PlayerUtils.GetPossibleWinningPlayers(players); List <Player> winningPlayers = PlayerUtils.ResolveTies(possibleWinners); return(winningPlayers); }
public void GeneratePlayers_BuildsAlistOfPlayersFromGameData() { string player1Name = "mockPlayer1"; List <Card> player1Cards = TestUtil.CreateDefaultThreeOfAKindCards(); string player2Name = "mockPlayer2"; List <Card> player2Cards = TestUtil.CreateDefaultPairCards(); Dictionary <string, List <Card> > gameData = new Dictionary <string, List <Card> > { { player1Name, player1Cards }, { player2Name, player2Cards } }; List <Player> players = PlayerUtils.GeneratePlayers(gameData); Assert.AreEqual(players.Count, 2); Assert.IsNotNull(players.Find((player) => player.Name == player1Name)); Assert.IsNotNull(players.Find((player) => player.Name == player2Name)); Assert.AreEqual(players.Find((player) => player.Name == player1Name).HandOfCards.GetHandType(), HandType.ThreeOfAKind); Assert.AreEqual(players.Find((player) => player.Name == player2Name).HandOfCards.GetHandType(), HandType.Pair); }