public void ShouldCheckIfIsNotAStraight()
        {
            var cartas = new List <Carta>
            {
                new Carta()
                {
                    NumCarta = NumCarta.Oito
                },
                new Carta()
                {
                    NumCarta = NumCarta.Nove
                },
                new Carta()
                {
                    NumCarta = NumCarta.As
                },
                new Carta()
                {
                    NumCarta = NumCarta.Valete
                },
                new Carta()
                {
                    NumCarta = NumCarta.Dama
                },
            };

            var cartasIguais = HandChecker.IsStraight(cartas);

            Assert.False(cartasIguais);
        }
Esempio n. 2
0
        public void IsStraightTest()
        {
            Assert.True(HandChecker.IsStraight(CardUtil.GetCards("AD KH QH JH TH")));
            Assert.True(HandChecker.IsStraight(CardUtil.GetCards("KH QD JH TH 9H")));
            Assert.True(HandChecker.IsStraight(CardUtil.GetCards("QH JH TD 9H 8H")));
            Assert.True(HandChecker.IsStraight(CardUtil.GetCards("8H 7H 6H 5D 4H")));
            Assert.True(HandChecker.IsStraight(CardUtil.GetCards("6H 5S 2H 3H 4D")));
            Assert.True(HandChecker.IsStraight(CardUtil.GetCards("AH 5H 4H 3D 2H")));

            Assert.False(HandChecker.IsStraight(CardUtil.GetCards("AH JH TH 9H 8H")));
            Assert.False(HandChecker.IsStraight(CardUtil.GetCards("QH JH TS 9H 7H")));
        }
        public Hands GetHand()
        {
            if (HandChecker.IsRoyalFlush(this.Cartas))
            {
                return(Hands.RoyalFlush);
            }
            if (HandChecker.IsStraightFlush(this.Cartas))
            {
                return(Hands.StraightFlush);
            }
            if (HandChecker.IsQuadra(this.Cartas))
            {
                return(Hands.Quadra);
            }
            if (HandChecker.IsFullHouse(this.Cartas))
            {
                return(Hands.FullHouse);
            }
            if (HandChecker.IsFlush(this.Cartas))
            {
                return(Hands.Flush);
            }
            if (HandChecker.IsStraight(this.Cartas))
            {
                return(Hands.Straight);
            }
            if (HandChecker.IsTrinca(this.Cartas))
            {
                return(Hands.Trinca);
            }
            if (HandChecker.IsTwoPairs(this.Cartas))
            {
                return(Hands.TwoPair);
            }
            if (HandChecker.IsPair(this.Cartas))
            {
                return(Hands.Pair);
            }

            return(Hands.HighCard);
        }