Exemplo n.º 1
0
        public void TexasHandSelectorTwoPairs()
        {
            //Arrange
            List <Card> cards = new List <Card>();

            cards.Add(new Card(Suits.Hearts, 2));
            cards.Add(new Card(Suits.Hearts, "A"));
            cards.Add(new Card(Suits.Spades, 3));
            cards.Add(new Card(Suits.Clubes, 3));
            cards.Add(new Card(Suits.Hearts, "K"));
            cards.Add(new Card(Suits.Dimensions, 2));
            cards.Add(new Card(Suits.Hearts, "J"));

            //Act
            TexasHandSelector handSelector = new TexasHandSelector();
            Hand twoPairs = handSelector.SelectBest(cards).Value;

            //Assert
            Assert.IsNotNull(twoPairs.IsMatch(cards));
            Assert.AreEqual(5, twoPairs.CardsInTheHand.Count);
            Assert.AreEqual <int>(3, twoPairs.CardsInTheHand[0].Value);
            Assert.AreEqual <int>(2, twoPairs.CardsInTheHand[2].Value);
            Assert.AreEqual <int>(14, twoPairs.CardsInTheHand[4].Value);
            Assert.AreEqual(Constancts.HandRanks.TwoPairs, twoPairs.Rank);
        }
Exemplo n.º 2
0
        public void TexasHandSelectorPair()
        {
            //Arrange
            List <Card> cards = new List <Card>();

            cards.Add(new Card(Suits.Hearts, 7));
            cards.Add(new Card(Suits.Hearts, "A"));
            cards.Add(new Card(Suits.Spades, 7));
            cards.Add(new Card(Suits.Clubes, 3));
            cards.Add(new Card(Suits.Hearts, "K"));
            cards.Add(new Card(Suits.Dimensions, 2));
            cards.Add(new Card(Suits.Hearts, 9));

            //Act
            TexasHandSelector handSelector = new TexasHandSelector();
            Hand pair = handSelector.SelectBest(cards).Value;

            //Assert
            Assert.IsNotNull(pair.IsMatch(cards));
            Assert.AreEqual(5, pair.CardsInTheHand.Count);
            Assert.AreEqual <int>(7, pair.CardsInTheHand[0].Value);
            Assert.AreEqual <int>(7, pair.CardsInTheHand[1].Value);
            Assert.AreEqual <int>(14, pair.CardsInTheHand[2].Value);
            Assert.AreEqual <int>(13, pair.CardsInTheHand[3].Value);
            Assert.AreEqual <int>(9, pair.CardsInTheHand[4].Value);
            Assert.AreEqual(Constancts.HandRanks.Pair, pair.Rank);
        }
Exemplo n.º 3
0
        public void TexasHandSelectorFourOfAKind()
        {
            //Arrange
            List <Card> cards = new List <Card>();

            cards.Add(new Card(Suits.Hearts, 3));
            cards.Add(new Card(Suits.Hearts, "A"));
            cards.Add(new Card(Suits.Spades, 3));
            cards.Add(new Card(Suits.Clubes, 3));
            cards.Add(new Card(Suits.Hearts, "K"));
            cards.Add(new Card(Suits.Dimensions, 3));
            cards.Add(new Card(Suits.Hearts, "J"));

            //Act
            TexasHandSelector handSelector = new TexasHandSelector();
            Hand fourOfAKind = handSelector.SelectBest(cards).Value;

            //Assert
            Assert.IsNotNull(fourOfAKind.IsMatch(cards));
            Assert.AreEqual(5, fourOfAKind.CardsInTheHand.Count);
            Assert.AreEqual <int>(14, fourOfAKind.CardsInTheHand[4].Value);
            Assert.AreEqual(Constancts.HandRanks.FourOfAKind, fourOfAKind.Rank);
        }
Exemplo n.º 4
0
        public void TexasHandSelectorFlush()
        {
            //Arrange
            List <Card> cards = new List <Card>();

            cards.Add(new Card(Suits.Clubes, "A"));
            cards.Add(new Card(Suits.Hearts, 3));
            cards.Add(new Card(Suits.Hearts, 7));
            cards.Add(new Card(Suits.Hearts, 5));
            cards.Add(new Card(Suits.Hearts, "T"));
            cards.Add(new Card(Suits.Hearts, "J"));
            cards.Add(new Card(Suits.Hearts, "Q"));

            //Act
            TexasHandSelector handSelector = new TexasHandSelector();
            Hand flush = handSelector.SelectBest(cards).Value;

            //Assert
            Assert.IsNotNull(flush.IsMatch(cards));
            Assert.AreEqual(5, flush.CardsInTheHand.Count);
            Assert.AreEqual <int>(12, flush.CardsInTheHand[0].Value);
            Assert.AreEqual <int>(5, flush.CardsInTheHand[4].Value);
            Assert.AreEqual(Constancts.HandRanks.Flush, flush.Rank);
        }
Exemplo n.º 5
0
        public void TexasHandSelectorStraightFlush6High()
        {
            //Arrange
            List <Card> cards = new List <Card>();

            cards.Add(new Card(Suits.Hearts, 3));
            cards.Add(new Card(Suits.Hearts, 2));
            cards.Add(new Card(Suits.Clubes, 3));
            cards.Add(new Card(Suits.Hearts, "A"));
            cards.Add(new Card(Suits.Hearts, 5));
            cards.Add(new Card(Suits.Hearts, 4));
            cards.Add(new Card(Suits.Hearts, 6));

            //Act
            TexasHandSelector handSelector = new TexasHandSelector();
            Hand straightFlush             = handSelector.SelectBest(cards).Value;

            //Assert
            Assert.IsNotNull(straightFlush.IsMatch(cards));
            Assert.AreEqual(5, straightFlush.CardsInTheHand.Count);
            Assert.AreEqual <int>(6, straightFlush.CardsInTheHand[0].Value);
            Assert.AreEqual <int>(2, straightFlush.CardsInTheHand[4].Value);
            Assert.AreEqual(Constancts.HandRanks.StraightFlush, straightFlush.Rank);
        }
Exemplo n.º 6
0
        public void TexasHandSelectorStraight10High()
        {
            //Arrange
            List <Card> cards = new List <Card>();

            cards.Add(new Card(Suits.Clubes, "A"));
            cards.Add(new Card(Suits.Hearts, 6));
            cards.Add(new Card(Suits.Dimensions, 7));
            cards.Add(new Card(Suits.Spades, 8));
            cards.Add(new Card(Suits.Clubes, "T"));
            cards.Add(new Card(Suits.Hearts, 9));
            cards.Add(new Card(Suits.Hearts, "Q"));

            //Act
            TexasHandSelector handSelector = new TexasHandSelector();
            Hand straight = handSelector.SelectBest(cards).Value;

            //Assert
            Assert.IsNotNull(straight);
            Assert.AreEqual(5, straight.CardsInTheHand.Count);
            Assert.AreEqual <int>(10, straight.CardsInTheHand[0].Value);
            Assert.AreEqual <int>(6, straight.CardsInTheHand[4].Value);
            Assert.AreEqual(Constancts.HandRanks.Straight, straight.Rank);
        }