public void ShouldCheckIfIsAFlush()
        {
            var cartas = new List <Carta>
            {
                new Carta()
                {
                    Naipe = Naipes.Copa
                },
                new Carta()
                {
                    Naipe = Naipes.Copa
                },
                new Carta()
                {
                    Naipe = Naipes.Copa
                },
                new Carta()
                {
                    Naipe = Naipes.Copa
                },
                new Carta()
                {
                    Naipe = Naipes.Copa
                }
            };

            var cartasIguais = HandChecker.IsFlush(cartas);

            Assert.IsTrue(cartasIguais);
        }
        public void ShouldCheckIfItIsNotAFlush()
        {
            var cartas = new List <Carta>
            {
                new Carta()
                {
                    Naipe = Naipes.Espadas
                },
                new Carta()
                {
                    Naipe = Naipes.Copa
                },
                new Carta()
                {
                    Naipe = Naipes.Copa
                },
                new Carta()
                {
                    Naipe = Naipes.Copa
                },
                new Carta()
                {
                    Naipe = Naipes.Copa
                }
            };

            var cartasIguais = HandChecker.IsFlush(cartas);

            Assert.IsFalse(cartasIguais);
        }
        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);
        }
Exemple #4
0
        public void IsFlushTest()
        {
            Assert.True(HandChecker.IsFlush(CardUtil.GetCards("AH JH TH 9H 8H")));

            Assert.False(HandChecker.IsFlush(CardUtil.GetCards("AH JC TH 9H 8H")));
        }