public void IsMatch_ThreeCardsOfSameRank_IsAMatch()
        {
            List <Card> cards = new List <Card>
            {
                new Card(CardSuit.Diamonds, CardRank.Nine),
                new Card(CardSuit.Clubs, CardRank.Nine),
                new Card(CardSuit.Spades, CardRank.Nine)
            };

            ThreeOfAKindRule rule    = new ThreeOfAKindRule();
            bool             isMatch = rule.IsMatch(cards);

            Assert.AreEqual(true, isMatch);
        }
        public void IsMatch_ThreeCardsOfSameSuitNotSameRank_IsNoMatch()
        {
            List <Card> cards = new List <Card>
            {
                new Card(CardSuit.Diamonds, CardRank.Nine),
                new Card(CardSuit.Diamonds, CardRank.Eight),
                new Card(CardSuit.Diamonds, CardRank.Seven)
            };

            ThreeOfAKindRule rule    = new ThreeOfAKindRule();
            bool             isMatch = rule.IsMatch(cards);

            Assert.AreEqual(false, isMatch);
        }
        public void IsMatch_HandContainsTwoSetsOfThreeSameCards_IsMatch()
        {
            List <Card> cards = new List <Card>
            {
                new Card(CardSuit.Diamonds, CardRank.Nine),
                new Card(CardSuit.Clubs, CardRank.Nine),
                new Card(CardSuit.Spades, CardRank.Nine),
                new Card(CardSuit.Diamonds, CardRank.Four),
                new Card(CardSuit.Clubs, CardRank.Four),
                new Card(CardSuit.Spades, CardRank.Four),
            };

            ThreeOfAKindRule rule    = new ThreeOfAKindRule();
            bool             isMatch = rule.IsMatch(cards);

            Assert.AreEqual(true, isMatch);
        }
Example #4
0
        public void ShouldReturnTrueWhenHasThreeSameValueCards(string cardText, bool expected)
        {
            var poker = new Player("Test", cardText);

            Assert.Equal(expected, _rule.IsMatch(poker.Cards));
        }