Example #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());
        }
Example #2
0
        public void TestReset()
        {
            var trick = new Trick();

            trick.AddCard(new Card("J", Suit.DIAMONDS, 1, 0));
            trick.AddCard(new Card("Q", Suit.CLUBS, 10, 1));
            trick.AddCard(new Card("10", Suit.SPADES, 100, 2));
            trick.AddCard(new Card("7", Suit.DIAMONDS, 1000, 3));
            trick.AddValue(42);
            trick.ResetDeck();
            Assert.Equal(0, trick.GetDeck().Count);
            Assert.Equal(0, trick.GetValue());
        }