Ejemplo n.º 1
0
        public void TestEqualsSelf()
        {
            var ace = new CardRank(CardRank.RankNames.Ace);

            bool equals = ace.Equals(ace);

            Assert.True(equals);
        }
Ejemplo n.º 2
0
        public void TestEqualsNull()
        {
            var ace = new CardRank(CardRank.RankNames.Ace);

            bool equals = ace.Equals(null);

            Assert.False(equals);
        }
Ejemplo n.º 3
0
        public void TestEqualsNotEquals()
        {
            var ace  = new CardRank(CardRank.RankNames.Ace);
            var king = new CardRank(CardRank.RankNames.King);

            bool equals = ace.Equals(king);

            Assert.False(equals);
        }
Ejemplo n.º 4
0
        public void TestEqualsNotCardRank()
        {
            var ace = new CardRank(CardRank.RankNames.Ace);
            var str = "A String";

            bool equals = ace.Equals(str);

            Assert.False(equals);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Checks if there are 3 and 2 sets of same ranked cards
        /// </summary>
        /// <param name="cards">Held cards</param>
        /// <returns>Returns True if cards qualify for Full House</returns>
        private bool IsFullHouse(Card[] cards)
        {
            for (int i = 0; i < Card.amountOfRanks; i++)
            {
                CardRank primaryCheckedRank = (CardRank)i;

                if (cards.Where(x => x.cardRank.Equals(primaryCheckedRank)).Count() == 3)
                {
                    for (int j = 0; j < Card.amountOfRanks; j++)
                    {
                        CardRank secondaryCheckedRank = (CardRank)j;

                        if (!secondaryCheckedRank.Equals(primaryCheckedRank) && cards.Where(x => x.cardRank.Equals(secondaryCheckedRank)).Count() == 2)
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }