Пример #1
0
        public void HandConstructorTest()
        {
            Card[]    cards  = { new Card(Suit.CLUBS, Rank.EIGHT), new Card(Suit.DIAMONDS, Rank.ACE), new Card(Suit.SPADES, Rank.ACE) };
            PokerHand target = new PokerHand(cards);

            Assert.AreEqual(true, target.Contains(new Card(Suit.SPADES, Rank.ACE)));
            Assert.AreEqual(true, target.Contains(new Card(Suit.CLUBS, Rank.EIGHT)));
            Assert.AreEqual(true, target.Contains(new Card(Suit.DIAMONDS, Rank.ACE)));
            Assert.AreEqual(false, target.Contains(new Card(Suit.HEARTS, Rank.THREE)));
        }
Пример #2
0
        public void InsertCardTest()
        {
            PokerHand target = new PokerHand(new Card(Suit.SPADES, Rank.ACE));
            Card      card   = new Card(Suit.SPADES, Rank.ACE);

            target.InsertCard(card);
            Assert.AreEqual(true, target.Contains(new Card(Suit.SPADES, Rank.ACE)));
            Assert.AreEqual(false, target.Contains(new Card(Suit.CLUBS, Rank.ACE)));
            Assert.AreEqual(2, target.CountOf(new Card(Suit.SPADES, Rank.ACE)));
        }
Пример #3
0
        public void Push_CardToEmptyPokerHand_AddsCardToHand()
        {
            // Arrange
            var hand = new PokerHand();
            var card = new Card(Rank.Ace, Suit.Spades);

            // Act
            hand.Push(card);

            // Assert
            Assert.IsTrue(hand.Contains(card));
        }
Пример #4
0
        public void ContainsTest()
        {
            PokerHand target   = new PokerHand();
            Suit      suit     = Suit.SPADES;
            Rank      rank     = Rank.ACE;
            bool      expected = false;
            bool      actual;

            actual = target.Contains(suit, rank);
            Assert.AreEqual(expected, actual);
            suit     = Suit.UNKNOWN;
            rank     = Rank.UNKNOWN;
            target   = new PokerHand(new Card(suit, rank));
            expected = true;
            actual   = target.Contains(suit, rank);
            Assert.AreEqual(expected, actual);
        }