IsStraightFlush() public méthode

public IsStraightFlush ( IHand hand ) : bool
hand IHand
Résultat bool
Exemple #1
0
        internal static int CompareTwoStraightFlushHands(IHand firstHand, IHand secondHand)
        {
            if (checker.IsStraightFlush(firstHand) && !checker.IsStraightFlush(secondHand))
            {
                return(1);
            }
            else if (!checker.IsStraightFlush(firstHand) && checker.IsStraightFlush(secondHand))
            {
                return(-1);
            }

            List <ICard> firstHandCards  = (List <ICard>)firstHand.Cards;
            List <ICard> secondHandCards = (List <ICard>)secondHand.Cards;

            PokerHandsChecker.SortCardsByFace(firstHandCards);
            PokerHandsChecker.SortCardsByFace(secondHandCards);

            int valueLastCardFromFirstHand  = (int)firstHandCards[firstHandCards.Count - 1].Face;
            int valueLastCardFromSecondHand = (int)secondHandCards[secondHandCards.Count - 1].Face;

            if (valueLastCardFromFirstHand > valueLastCardFromSecondHand)
            {
                return(1);
            }
            else if (valueLastCardFromFirstHand < valueLastCardFromSecondHand)
            {
                return(-1);
            }
            else
            {
                return(0);
            }
        }
        private static void Main()
        {
            try
            {
                IHand hand = new Hand(new List<ICard>() 
                { 
                    new Card(CardFace.Ace, CardSuit.Clubs),
                    new Card(CardFace.Queen, CardSuit.Clubs),
                    new Card(CardFace.King, CardSuit.Clubs),
                    new Card(CardFace.Jack, CardSuit.Clubs),
                    new Card(CardFace.Ten, CardSuit.Clubs),
                });
                Console.WriteLine(hand);
                IPokerHandsChecker checker = new PokerHandsChecker();

                Console.WriteLine(checker.IsValidHand(hand) ? "Hand is valid." : "Hand is not valid!");
                Console.WriteLine(checker.IsRoyalFlush(hand) ? "Royal flush." : "Hand is not Royal flush!");
                Console.WriteLine(checker.IsStraightFlush(hand) ? "Straight flush." : "Hand is not Straight flush!");
                Console.WriteLine(checker.IsFlush(hand) ? "Flush." : "Hand is not Flush!");
                Console.WriteLine(checker.IsStraight(hand) ? "Straight." : "Hand is not Straight!");
                Console.WriteLine(checker.IsFullHouse(hand) ? "Full house." : "Hand is not Full house!");
                Console.WriteLine(checker.IsFourOfAKind(hand) ? "Four of a kind." : "Hand is not Four of a kind!");
                Console.WriteLine(checker.IsThreeOfAKind(hand) ? "Three of a kind." : "Hand is not Three of a kind!");

                IHand hand1 = new Hand("K♥ J♥ 8♣ 7♦ 4♠");
                Console.WriteLine(hand1);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        static void Main()
        {
            ICard card = new Card(CardFace.Ace, CardSuit.Clubs);
            Console.WriteLine(card);

            IHand hand = new Hand(new List<ICard>() { 
                new Card(CardFace.Ace, CardSuit.Clubs),
                new Card(CardFace.Ace, CardSuit.Diamonds),
                new Card(CardFace.King, CardSuit.Hearts),
                new Card(CardFace.King, CardSuit.Spades),
                new Card(CardFace.Seven, CardSuit.Diamonds),
            });
            Console.WriteLine(hand);

            IPokerHandsChecker checker = new PokerHandsChecker();
            Console.WriteLine(checker.IsValidHand(hand));
            Console.WriteLine(checker.IsStraight(hand));
            Console.WriteLine(checker.IsOnePair(hand));
            Console.WriteLine(checker.IsTwoPair(hand));
            Console.WriteLine(checker.IsStraightFlush(hand));
            Console.WriteLine(checker.IsFlush(hand));
            Console.WriteLine(checker.IsFourOfAKind(hand));
            Console.WriteLine(checker.IsThreeOfAKind(hand));
            Console.WriteLine(checker.IsHighCard(hand));
            Console.WriteLine(checker.IsFullHouse(hand));
        }
        static void Main()
        {
            ICard card = new Card(CardFace.Ace, CardSuit.Clubs);

            Console.WriteLine(card);

            IHand hand = new Hand(new List <ICard>()
            {
                new Card(CardFace.Ace, CardSuit.Clubs),
                new Card(CardFace.Ace, CardSuit.Diamonds),
                new Card(CardFace.King, CardSuit.Hearts),
                new Card(CardFace.King, CardSuit.Spades),
                new Card(CardFace.Seven, CardSuit.Diamonds),
            });

            Console.WriteLine(hand);

            IPokerHandsChecker checker = new PokerHandsChecker();
            //Console.WriteLine(checker.IsValidHand(hand));
            //Console.WriteLine(checker.IsOnePair(hand));
            //Console.WriteLine(checker.IsTwoPair(hand));

            // vasil test
            IList <ICard> cards = new List <ICard>();

            cards.Add(new Card(CardFace.Ace, CardSuit.Diamonds));
            cards.Add(new Card(CardFace.Six, CardSuit.Diamonds));
            cards.Add(new Card(CardFace.Two, CardSuit.Diamonds));
            cards.Add(new Card(CardFace.Three, CardSuit.Diamonds));
            cards.Add(new Card(CardFace.Five, CardSuit.Diamonds));
            hand = new Hand(cards);
            Console.WriteLine(checker.IsStraightFlush(hand));
        }
        public void StraightFlushHand()
        {
            var hand = new Hand(new List<ICard>() {
                new Card(CardFace.Seven, CardSuit.Clubs),
                new Card(CardFace.Eight, CardSuit.Clubs),
                new Card(CardFace.Nine, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs),
                new Card(CardFace.Jack, CardSuit.Clubs)
            });

            var checker = new PokerHandsChecker();
            Assert.IsTrue(checker.IsStraightFlush(hand));
        }
 public void TestIsStraightFlushLessCards()
 {
     Card cardOne = new Card(CardFace.Two, CardSuit.Diamonds);
     Card cardTwo = new Card(CardFace.Four, CardSuit.Diamonds);
     Card cardThree = new Card(CardFace.Three, CardSuit.Diamonds);
     IList<ICard> cards = new List<ICard>();
     cards.Add(cardOne);
     cards.Add(cardTwo);
     cards.Add(cardThree);
     Hand hand = new Hand(cards);
     PokerHandsChecker poker = new PokerHandsChecker();
     bool isStraightFlush = poker.IsStraightFlush(hand);
     Assert.AreEqual(false, isStraightFlush, "IsStraightFlush() method in class PokerHandsChecker is not working correctly.");
 }
 public void IsStraightFlush_True()
 {
     PokerHandsChecker checker = new PokerHandsChecker();
     List<ICard> cardList = new List<ICard>
     {
         new Card(CardFace.Ten,CardSuit.Diamonds),
         new Card(CardFace.Jack,CardSuit.Diamonds),
         new Card(CardFace.Queen,CardSuit.Diamonds),
         new Card(CardFace.King,CardSuit.Diamonds),
         new Card(CardFace.Ace,CardSuit.Diamonds)
     };
     Hand hand = new Hand(cardList);
     bool isStraightFlush = checker.IsStraightFlush(hand);
     Assert.IsTrue(isStraightFlush);
 }
 public void StraightFlushSecondTest()
 {
     List<Card> cards = new List<Card>(){
         new Card(CardFace.Nine, CardSuit.Hearts),
         new Card(CardFace.Ten, CardSuit.Hearts),
         new Card(CardFace.Jack, CardSuit.Hearts),
         new Card(CardFace.Queen, CardSuit.Hearts),
         new Card(CardFace.King, CardSuit.Hearts)
     };
     Hand hand = new Hand(cards.ToArray());
     PokerHandsChecker checker = new PokerHandsChecker();
     var excpected = true;
     var actual = checker.IsStraightFlush(hand);
     Assert.AreEqual(excpected, actual);
 }
        public void IsStraightFlush_HandWithFullStraightTheWheel()
        {
            IList<ICard> cards = new List<ICard>
            {
                new Card(CardFace.Ace, CardSuit.Diamonds),
                new Card(CardFace.Two, CardSuit.Diamonds),
                new Card(CardFace.Three, CardSuit.Diamonds),
                new Card(CardFace.Four, CardSuit.Diamonds),
                new Card(CardFace.Five, CardSuit.Diamonds),
            };

            Hand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

            Assert.IsTrue(checker.IsStraightFlush(hand));
        }
        public void IsStraightFlush_HandWithStraight()
        {
            IList<ICard> cards = new List<ICard>
            {
                new Card(CardFace.Ace, CardSuit.Diamonds),
                new Card(CardFace.King, CardSuit.Hearts),
                new Card(CardFace.Queen, CardSuit.Clubs),
                new Card(CardFace.Jack, CardSuit.Hearts),
                new Card(CardFace.Ten, CardSuit.Spades),
            };

            Hand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

            Assert.IsFalse(checker.IsStraightFlush(hand));
        }
 public void TestIsStraightFlushNotArangedCards()
 {
     Card cardOne = new Card(CardFace.Ten, CardSuit.Diamonds);
     Card cardTwo = new Card(CardFace.Queen, CardSuit.Diamonds);
     Card cardThree = new Card(CardFace.Ace, CardSuit.Diamonds);
     Card cardFour = new Card(CardFace.Jack, CardSuit.Diamonds);
     Card cardFive = new Card(CardFace.King, CardSuit.Diamonds);
     IList<ICard> cards = new List<ICard>();
     cards.Add(cardOne);
     cards.Add(cardTwo);
     cards.Add(cardThree);
     cards.Add(cardFour);
     cards.Add(cardFive);
     Hand hand = new Hand(cards);
     PokerHandsChecker poker = new PokerHandsChecker();
     bool isStraightFlush = poker.IsStraightFlush(hand);
     Assert.AreEqual(true, isStraightFlush, "IsStraightFlush() method in class PokerHandsChecker is not working correctly.");
 }
        public void StraightFlushhtWithAceAsMin()
        {
            IList<ICard> cards = new List<ICard>();
            cards.Add(new Card(CardFace.Ace, CardSuit.Hearts));
            cards.Add(new Card(CardFace.Two, CardSuit.Hearts));
            cards.Add(new Card(CardFace.Three, CardSuit.Hearts));
            cards.Add(new Card(CardFace.Four, CardSuit.Hearts));
            cards.Add(new Card(CardFace.Five, CardSuit.Hearts));

            Hand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

            bool result = checker.IsStraightFlush(hand);
            bool expected = true;

            Assert.AreEqual(expected, result);
        }
        public void Straight()
        {
            IList<ICard> cards = new List<ICard>();
            cards.Add(new Card(CardFace.Four, CardSuit.Diamonds));
            cards.Add(new Card(CardFace.Five, CardSuit.Hearts));
            cards.Add(new Card(CardFace.Six, CardSuit.Spades));
            cards.Add(new Card(CardFace.Seven, CardSuit.Clubs));
            cards.Add(new Card(CardFace.Eight, CardSuit.Clubs));

            Hand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

            bool result = checker.IsStraightFlush(hand);
            bool expected = false;

            Assert.AreEqual(expected, result);
        }
        public void IsStraightFlushTest()
        {
            Card aceClubs = new Card(CardFace.Ace, CardSuit.Clubs);
            Card queenClubs = new Card(CardFace.Queen, CardSuit.Clubs);
            Card kingClubs = new Card(CardFace.King, CardSuit.Clubs);
            Card jackClubs = new Card(CardFace.Jack, CardSuit.Clubs);
            Card tenOfClubs = new Card(CardFace.Ten, CardSuit.Clubs);

            List<ICard> cardsInHand = new List<ICard>();

            cardsInHand.Add(tenOfClubs);
            cardsInHand.Add(aceClubs);
            cardsInHand.Add(jackClubs);
            cardsInHand.Add(queenClubs);
            cardsInHand.Add(kingClubs);

            IHand hand = new Hand(cardsInHand);

            PokerHandsChecker handsChecker = new PokerHandsChecker();

            Assert.IsTrue(handsChecker.IsStraightFlush(hand));
        }
        public void IsNotStraightFlushTest()
        {
            Card twoOfHearts = new Card(CardFace.Two, CardSuit.Hearts);
            Card aceOfSpades = new Card(CardFace.Ace, CardSuit.Spades);
            Card threeOfHearts = new Card(CardFace.Three, CardSuit.Hearts);
            Card kingOfHearts = new Card(CardFace.King, CardSuit.Hearts);
            Card tenOfHearts = new Card(CardFace.Ten, CardSuit.Hearts);

            List<ICard> cardsInHand = new List<ICard>();

            cardsInHand.Add(twoOfHearts);
            cardsInHand.Add(aceOfSpades);
            cardsInHand.Add(threeOfHearts);
            cardsInHand.Add(kingOfHearts);
            cardsInHand.Add(tenOfHearts);

            IHand hand = new Hand(cardsInHand);

            PokerHandsChecker handsChecker = new PokerHandsChecker();

            Assert.IsFalse(handsChecker.IsStraightFlush(hand));
        }
        public void IsStraightFlush_ReturnsFalseOnStraight()
        {
            IList<ICard> cards = new List<ICard>();
            cards.Add(new Card(CardFace.Five, CardSuit.Spades));
            cards.Add(new Card(CardFace.Ten, CardSuit.Clubs));
            cards.Add(new Card(CardFace.Seven, CardSuit.Spades));
            cards.Add(new Card(CardFace.Nine, CardSuit.Spades));
            cards.Add(new Card(CardFace.Six, CardSuit.Spades));

            IHand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();
            bool isStraightFlush = checker.IsStraightFlush(hand);
            Assert.AreEqual(false, isStraightFlush);
        }
        public void IsStraightFlush_ReturnsTrueOnRoyal()
        {
            IList<ICard> cards = new List<ICard>();
            cards.Add(new Card(CardFace.King, CardSuit.Spades));
            cards.Add(new Card(CardFace.Ace, CardSuit.Spades));
            cards.Add(new Card(CardFace.Jack, CardSuit.Spades));
            cards.Add(new Card(CardFace.Ten, CardSuit.Spades));
            cards.Add(new Card(CardFace.Queen, CardSuit.Spades));

            IHand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();
            bool isStraightFlush = checker.IsStraightFlush(hand);
            Assert.AreEqual(true, isStraightFlush);
        }
        public void TestIsStraightFlushShouldReturnTrue_TenToAce()
        {
            var checker = new PokerHandsChecker();
            var cards = new List<ICard>
            {
                new Card(CardFace.Ace, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Clubs),
                new Card(CardFace.King, CardSuit.Clubs),
                new Card(CardFace.Jack, CardSuit.Clubs),
                new Card(CardFace.Queen, CardSuit.Clubs)
            };
            var hand = new Hand(cards);

            Assert.IsTrue(checker.IsStraightFlush(hand));
        }
        public void TestIsStraightFlushShouldReturnTrue_AceToFive()
        {
            var checker = new PokerHandsChecker();
            var cards = new List<ICard>
            {
                new Card(CardFace.Ace, CardSuit.Clubs),
                new Card(CardFace.Two, CardSuit.Clubs),
                new Card(CardFace.Three, CardSuit.Clubs),
                new Card(CardFace.Four, CardSuit.Clubs),
                new Card(CardFace.Five, CardSuit.Clubs)
            };
            var hand = new Hand(cards);

            Assert.IsTrue(checker.IsStraightFlush(hand));
        }
        public void StraightFlushHandCheckerShouldReturnTrueWhenTheHandIsAValidStraightFlushHand()
        {
            IPokerHandsChecker checker = new PokerHandsChecker();
            IHand hand = new Hand(new List<ICard>()
            {
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Two, CardSuit.Clubs),
                new Card(CardFace.Four, CardSuit.Clubs),
                new Card(CardFace.Five, CardSuit.Clubs),
                new Card(CardFace.Three, CardSuit.Clubs)
            });
            bool result = checker.IsStraightFlush(hand);
            bool expected = true;

            Assert.AreEqual(result, expected);
        }
        public void FlushOnlyNoStraight()
        {
            IList<ICard> cards = new List<ICard>();
            cards.Add(new Card(CardFace.King, CardSuit.Clubs));
            cards.Add(new Card(CardFace.Three, CardSuit.Clubs));
            cards.Add(new Card(CardFace.Four, CardSuit.Clubs));
            cards.Add(new Card(CardFace.Eight, CardSuit.Clubs));
            cards.Add(new Card(CardFace.Ten, CardSuit.Clubs));

            Hand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

            bool result = checker.IsStraightFlush(hand);
            bool expected = false;

            Assert.AreEqual(expected, result);
        }
 public void IsStraightFlushTest3()
 {
     PokerHandsChecker target = new PokerHandsChecker();
     IList<ICard> cards = new List<ICard>();
     cards.Add(new Card(CardFace.Jack, CardSuit.Hearts));
     cards.Add(new Card(CardFace.Ten, CardSuit.Hearts));
     cards.Add(new Card(CardFace.Nine, CardSuit.Hearts));
     cards.Add(new Card(CardFace.Eight, CardSuit.Hearts));
     cards.Add(new Card(CardFace.Seven, CardSuit.Hearts));
     IHand hand = new Hand(cards);
     bool expected = true;
     bool actual;
     actual = target.IsStraightFlush(hand);
     Assert.AreEqual(expected, actual);
 }
 public void IsStraightFlushTest2()
 {
     PokerHandsChecker target = new PokerHandsChecker();
     IList<ICard> cards = new List<ICard>();
     cards.Add(new Card(CardFace.Five, CardSuit.Hearts));
     cards.Add(new Card(CardFace.Four, CardSuit.Hearts));
     cards.Add(new Card(CardFace.Three, CardSuit.Hearts));
     cards.Add(new Card(CardFace.Two, CardSuit.Hearts));
     cards.Add(new Card(CardFace.Ace, CardSuit.Hearts));
     IHand hand = new Hand(cards);
     bool expected = true;
     bool actual;
     actual = target.IsStraightFlush(hand);
     Assert.AreEqual(expected, actual);
 }
        public void StraightFlushHandCheckerShouldReturnFalseWhenHandIsFlush()
        {
            IPokerHandsChecker checker = new PokerHandsChecker();
            IHand hand = new Hand(new List<ICard>()
            {
                new Card(CardFace.Eight, CardSuit.Diamonds),
                new Card(CardFace.King, CardSuit.Diamonds),
                new Card(CardFace.Queen, CardSuit.Diamonds),
                new Card(CardFace.Five, CardSuit.Diamonds),
                new Card(CardFace.Four, CardSuit.Diamonds)
            });
            bool result = checker.IsStraightFlush(hand);
            bool expected = false;

            Assert.AreEqual(result, expected);
        }
        public void IsStraightFlush_ReturnsTrueOnSteelWheel()
        {
            IList<ICard> cards = new List<ICard>();
            cards.Add(new Card(CardFace.Five, CardSuit.Spades));
            cards.Add(new Card(CardFace.Four, CardSuit.Spades));
            cards.Add(new Card(CardFace.Three, CardSuit.Spades));
            cards.Add(new Card(CardFace.Two, CardSuit.Spades));
            cards.Add(new Card(CardFace.Ace, CardSuit.Spades));

            IHand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();
            bool isStraightFlush = checker.IsStraightFlush(hand);
            Assert.AreEqual(true, isStraightFlush);
        }
        public void IsStraightFlush_HandWithTwoPairs()
        {
            IList<ICard> cards = new List<ICard>
            {
                new Card(CardFace.Ace, CardSuit.Diamonds),
                new Card(CardFace.Ace, CardSuit.Hearts),
                new Card(CardFace.Eight, CardSuit.Clubs),
                new Card(CardFace.Six, CardSuit.Hearts),
                new Card(CardFace.Six, CardSuit.Spades),
            };

            Hand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

            Assert.IsFalse(checker.IsStraightFlush(hand));
        }
 public void TestPokerCheckerStraightFlushHand()
 {
     List<ICard> cards = new List<ICard>();
     cards.Add(new Card(CardFace.Two, CardSuit.Clubs));
     cards.Add(new Card(CardFace.Three, CardSuit.Clubs));
     cards.Add(new Card(CardFace.Four, CardSuit.Clubs));
     cards.Add(new Card(CardFace.Five, CardSuit.Clubs));
     cards.Add(new Card(CardFace.Six, CardSuit.Clubs));
     var hand = new Hand(cards);
     var checker = new PokerHandsChecker();
     Assert.IsTrue(checker.IsStraightFlush(hand));
 }
        public void FourSequenceWithSameSuit()
        {
            IList<ICard> cards = new List<ICard>();
            cards.Add(new Card(CardFace.Seven, CardSuit.Clubs));
            cards.Add(new Card(CardFace.Eight, CardSuit.Clubs));
            cards.Add(new Card(CardFace.Nine, CardSuit.Clubs));
            cards.Add(new Card(CardFace.Ten, CardSuit.Clubs));
            cards.Add(new Card(CardFace.Queen, CardSuit.Clubs));

            Hand hand = new Hand(cards);

            PokerHandsChecker checker = new PokerHandsChecker();

            bool result = checker.IsStraightFlush(hand);
            bool expected = false;

            Assert.AreEqual(expected, result);
        }
        static void Main()
        {
            ICard card = new Card(CardFace.Ace, CardSuit.Clubs);

            Console.WriteLine("Current card is: " + card + Environment.NewLine);

            ///Normal hand\\\
            IHand hand = new Hand(new List <ICard>()
            {
                new Card(CardFace.Three, CardSuit.Clubs),
                new Card(CardFace.Six, CardSuit.Diamonds),
                new Card(CardFace.King, CardSuit.Hearts),
                new Card(CardFace.Two, CardSuit.Spades),
                new Card(CardFace.Seven, CardSuit.Diamonds),
            });

            /////Flush\\\
            //IHand hand = new Hand(new List<ICard>() {
            //    new Card(CardFace.Ace, CardSuit.Clubs),
            //    new Card(CardFace.Ace, CardSuit.Clubs),
            //    new Card(CardFace.King, CardSuit.Clubs),
            //    new Card(CardFace.King, CardSuit.Clubs),
            //    new Card(CardFace.Seven, CardSuit.Clubs),
            //});

            /////Four of a kind\\\
            //IHand hand = new Hand(new List<ICard>() {
            //    new Card(CardFace.Ace, CardSuit.Clubs),
            //    new Card(CardFace.Ace, CardSuit.Diamonds),
            //    new Card(CardFace.Ace, CardSuit.Hearts),
            //    new Card(CardFace.Ace, CardSuit.Spades),
            //    new Card(CardFace.Eight, CardSuit.Clubs),
            //});

            /////One pair\\\
            //IHand hand = new Hand(new List<ICard>() {
            //    new Card(CardFace.Ace, CardSuit.Clubs),
            //    new Card(CardFace.Ace, CardSuit.Diamonds),
            //    new Card(CardFace.Five, CardSuit.Hearts),
            //    new Card(CardFace.Jack, CardSuit.Spades),
            //    new Card(CardFace.Eight, CardSuit.Clubs),
            //});

            /////Two pairs\\\
            //IHand hand = new Hand(new List<ICard>() {
            //    new Card(CardFace.Ace, CardSuit.Clubs),
            //    new Card(CardFace.Ace, CardSuit.Diamonds),
            //    new Card(CardFace.Five, CardSuit.Hearts),
            //    new Card(CardFace.Jack, CardSuit.Spades),
            //    new Card(CardFace.Jack, CardSuit.Clubs),
            //});

            /////Straight Flush\\\
            //IHand hand = new Hand(new List<ICard>() {
            //    new Card(CardFace.Jack, CardSuit.Clubs),
            //    new Card(CardFace.Ten, CardSuit.Clubs),
            //    new Card(CardFace.Nine, CardSuit.Clubs),
            //    new Card(CardFace.Eight, CardSuit.Clubs),
            //    new Card(CardFace.Seven, CardSuit.Clubs),
            //});

            /////Full House\\\
            //IHand hand = new Hand(new List<ICard>() {
            //    new Card(CardFace.Six, CardSuit.Diamonds),
            //    new Card(CardFace.Six, CardSuit.Hearts),
            //    new Card(CardFace.Nine, CardSuit.Clubs),
            //    new Card(CardFace.Nine, CardSuit.Spades),
            //    new Card(CardFace.Nine, CardSuit.Clubs),
            //});

            /////Straight\\\
            //IHand hand = new Hand(new List<ICard>() {
            //    new Card(CardFace.King, CardSuit.Diamonds),
            //    new Card(CardFace.Queen, CardSuit.Hearts),
            //    new Card(CardFace.Jack, CardSuit.Clubs),
            //    new Card(CardFace.Ten, CardSuit.Spades),
            //    new Card(CardFace.Nine, CardSuit.Clubs),
            //});

            Console.WriteLine(hand + Environment.NewLine);

            IPokerHandsChecker checker = new PokerHandsChecker();

            Console.WriteLine("Is this hand valid: " + checker.IsValidHand(hand));
            Console.WriteLine("Do you have one pair: " + checker.IsOnePair(hand));
            Console.WriteLine("Do you have two pairs: " + checker.IsTwoPair(hand));
            Console.WriteLine("Do you have a flush: " + checker.IsFlush(hand));
            Console.WriteLine("Do you have four of a kind: " + checker.IsFourOfAKind(hand));
            Console.WriteLine("Do you have three of a kind: " + checker.IsThreeOfAKind(hand));
            Console.WriteLine("Do you have straight flush: " + checker.IsStraightFlush(hand));
            Console.WriteLine("Do you have a full house: " + checker.IsFullHouse(hand));
            Console.WriteLine("Do you have a straight: " + checker.IsStraight(hand));
            Console.WriteLine("Do you have high card: " + checker.IsHighCard(hand));
        }
        public void TestIsStraightFlushShouldReturnFalseWhenNotMatchingHandPassed_Straight()
        {
            var checker = new PokerHandsChecker();
            var cards = new List<ICard>
            {
                new Card(CardFace.Seven, CardSuit.Clubs),
                new Card(CardFace.Eight, CardSuit.Clubs),
                new Card(CardFace.Nine, CardSuit.Clubs),
                new Card(CardFace.Ten, CardSuit.Hearts),
                new Card(CardFace.Jack, CardSuit.Clubs)
            };
            var hand = new Hand(cards);

            Assert.IsFalse(checker.IsStraightFlush(hand));
        }
        public void StraightFlushHandCheckerShouldReturnFalseWhenHandIsStraight()
        {
            IPokerHandsChecker checker = new PokerHandsChecker();
            IHand hand = new Hand(new List<ICard>()
            {
                new Card(CardFace.Six, CardSuit.Clubs),
                new Card(CardFace.Two, CardSuit.Diamonds),
                new Card(CardFace.Four, CardSuit.Clubs),
                new Card(CardFace.Five, CardSuit.Spades),
                new Card(CardFace.Three, CardSuit.Hearts)
            });
            bool result = checker.IsStraightFlush(hand);
            bool expected = false;

            Assert.AreEqual(result, expected);
        }
 public void TestIsStraightFlushOtherCombination()
 {
     Card cardOne = new Card(CardFace.Ten, CardSuit.Diamonds);
     Card cardTwo = new Card(CardFace.Ten, CardSuit.Hearts);
     Card cardThree = new Card(CardFace.Ten, CardSuit.Spades);
     Card cardFour = new Card(CardFace.Ten, CardSuit.Clubs);
     Card cardFive = new Card(CardFace.King, CardSuit.Clubs);
     IList<ICard> cards = new List<ICard>();
     cards.Add(cardOne);
     cards.Add(cardTwo);
     cards.Add(cardThree);
     cards.Add(cardFour);
     cards.Add(cardFive);
     Hand hand = new Hand(cards);
     PokerHandsChecker poker = new PokerHandsChecker();
     bool isStraightFlush = poker.IsStraightFlush(hand);
     Assert.AreEqual(false, isStraightFlush, "IsStraightFlush() method in class PokerHandsChecker is not working correctly.");
 }
        public void IsStraightFlushTestValidNotHand()
        {
            PokerHandsChecker checker = new PokerHandsChecker();

            Hand hand = new Hand(new List<ICard>()
            {
                new Card(CardFace.Ace, CardSuit.Clubs),
                new Card(CardFace.King, CardSuit.Spades),
                new Card(CardFace.King, CardSuit.Spades),
                new Card(CardFace.Queen, CardSuit.Diamonds),
                new Card(CardFace.Two, CardSuit.Spades)
            });

            bool expectedIsStraightFlush = false;
            bool actual;
            actual = checker.IsStraightFlush(hand);
            Assert.AreEqual(expectedIsStraightFlush, actual);
        }