示例#1
0
        public void TestValue()
        {
            var        player = new Player(0, "PlayerTest", null);
            const Suit trump  = Suit.DIAMONDS;

            Card[] cards =
            {
                new Card("10", Suit.DIAMONDS,    1, 0),
                new Card("A",  Suit.DIAMONDS,   10, 1),
                new Card("9",  Suit.DIAMONDS,  100, 2),
                new Card("J",  Suit.DIAMONDS, 1000, 3)
            };
            foreach (var card in cards)
            {
                player.GetDeck().AddCard(card);
            }
            var trick     = new Trick();
            var firstCard = new Card("8", Suit.SPADES, 0, 8);

            trick.AddCard(firstCard);
            trick.SetLeadingCard(firstCard);
            Assert.Equal(true, player.PutCard(trick, player.GetDeck().GetCardById(0).GetId(), trump));
            Assert.Equal(true, player.PutCard(trick, player.GetDeck().GetCardById(1).GetId(), trump));
            Assert.Equal(true, player.PutCard(trick, player.GetDeck().GetCardById(2).GetId(), trump));
            Assert.Equal(true, player.PutCard(trick, player.GetDeck().GetCardById(3).GetId(), trump));
            Assert.Equal(1111, trick.GetValue());
        }
示例#2
0
        public void TestPutCardCuttingNonTrumpTrick()
        {
            var        player = new Player(0, "PlayerTest", null);
            const Suit trump  = Suit.DIAMONDS;

            Card[] cards =
            {
                new Card("J",  Suit.DIAMONDS, 0, 0),
                new Card("9",  Suit.DIAMONDS, 0, 1),
                new Card("Q",  Suit.CLUBS,    0, 2),
                new Card("J",  Suit.CLUBS,    0, 3),
                new Card("Q",  Suit.CLUBS,    0, 4),
                new Card("K",  Suit.HEARTS,   0, 5),
                new Card("7",  Suit.HEARTS,   0, 6),
                new Card("10", Suit.SPADES,   0, 7)
            };
            foreach (var card in cards)
            {
                player.GetDeck().AddCard(card);
            }

            var trick     = new Trick();
            var firstCard = new Card("8", Suit.SPADES, 0, 8);

            trick.AddCard(firstCard);
            trick.SetLeadingCard(firstCard);
            Assert.Equal(true, player.PutCard(trick, player.GetDeck().GetCardById(7).GetId(), trump));
            Assert.Equal(true, player.PutCard(trick, player.GetDeck().GetCardById(1).GetId(), trump));
            Assert.Equal(true, player.PutCard(trick, player.GetDeck().GetCardById(0).GetId(), trump));
        }