Exemple #1
0
        public void PlayWithRankTest()
        {
            var players      = PlayersSetup.BuildFourAIPlayers();
            var secondPlayer = players[1];

            var cardsHeldByPlayer   = new Dictionary <IPlayer, List <Card> >();
            var cardsPlayedByPlayer = new Dictionary <IPlayer, List <Card> >();

            var heart = SuitHelper.GetSuit(CardSuit.Heart);
            var spade = SuitHelper.GetSuit(CardSuit.Spade);

            cardsHeldByPlayer[players[0]] = new List <Card> {
                new Card(RankHelper.GetRank("7"), heart)
            };
            cardsHeldByPlayer[players[1]] = new List <Card> {
                new Card(RankHelper.GetRank("A"), heart)
            };
            cardsHeldByPlayer[players[2]] = new List <Card> {
                new Card(RankHelper.GetRank("8"), heart)
            };
            cardsHeldByPlayer[players[3]] = new List <Card> {
                new Card(RankHelper.GetRank("9"), heart)
            };

            var trick = new Trick(players, spade);

            trick.Play(cardsHeldByPlayer, cardsPlayedByPlayer);
            var winner = trick.GetTaker();

            Assert.AreEqual(secondPlayer, winner);

            var playedCards = trick.GetPlayedCards();

            Assert.IsNotNull(playedCards);
            Assert.AreEqual(4, playedCards.Count);
        }