Exemplo n.º 1
0
        public void ShouldReturnTrueWhenPokerHasThreeSameCardAndAPair(string cardText, bool expected)
        {
            var rule = new FullHouseRule();

            var poker = new Player("FullHouse", cardText);

            Assert.Equal(expected, rule.IsMatch(poker.Cards));
        }
Exemplo n.º 2
0
        public void Awards2500PtsForAllRolls(DieRoll threeDice, DieRoll twoDice)
        {
            KeyValuePair <DieRoll, int> setOfThreeDice = new KeyValuePair <DieRoll, int>(threeDice, 3);
            KeyValuePair <DieRoll, int> setOfTwoDice   = new KeyValuePair <DieRoll, int>(twoDice, 2);
            var dice = FakeDiceRollFactory.GetSetOfRolls(setOfThreeDice, setOfTwoDice);

            var result = new FullHouseRule().CountPoints(new DiceRoll(dice));

            Assert.True(result.Points == _points, $"Awarded {result.Points} instead of {_points}.");
        }
Exemplo n.º 3
0
        public void CanBeDoneThroughRollingAConsecutiveSequence(DieRoll threeDice, DieRoll twoDice)
        {
            KeyValuePair <DieRoll, int> setOfThreeDice = new KeyValuePair <DieRoll, int>(threeDice, 3);
            KeyValuePair <DieRoll, int> setOfTwoDice   = new KeyValuePair <DieRoll, int>(twoDice, 2);
            var dice = FakeDiceRollFactory.GetSetOfRolls(setOfThreeDice, setOfTwoDice);

            var result = new FullHouseRule().CountPoints(new DiceRoll(dice));

            Assert.True(result.DiceCombination == _combination, $"Expected {_combination} combination, but got {result.DiceCombination} instead.");
        }
Exemplo n.º 4
0
        public void CardList_Is_Not_FullHouse()
        {
            var cardList = new List <Card>()
            {
                new Card()
                {
                    FaceValue = CardFaceValue.Jack, Suit = CardSuit.Spades
                },
                new Card()
                {
                    FaceValue = CardFaceValue.Queen, Suit = CardSuit.Clubs
                },
                new Card()
                {
                    FaceValue = CardFaceValue.Jack, Suit = CardSuit.Diamonds
                },
                new Card()
                {
                    FaceValue = CardFaceValue.Eight, Suit = CardSuit.Hearts
                },
                new Card()
                {
                    FaceValue = CardFaceValue.Four, Suit = CardSuit.Spades
                },
                new Card()
                {
                    FaceValue = CardFaceValue.HighAce, Suit = CardSuit.Hearts
                },
                new Card()
                {
                    FaceValue = CardFaceValue.HighAce, Suit = CardSuit.Spades
                },
                new Card()
                {
                    FaceValue = CardFaceValue.Four, Suit = CardSuit.Hearts
                },
                new Card()
                {
                    FaceValue = CardFaceValue.Queen, Suit = CardSuit.Hearts
                },
                new Card()
                {
                    FaceValue = CardFaceValue.King, Suit = CardSuit.Hearts
                },
                new Card()
                {
                    FaceValue = CardFaceValue.Five, Suit = CardSuit.Hearts
                }
            };

            var rule = new FullHouseRule();
            var hand = rule.BuildStrongestHand(cardList);

            Assert.IsNull(hand);
        }
Exemplo n.º 5
0
        public void CardList_Is_FullHouse()
        {
            var cardList = new List <Card>()
            {
                new Card()
                {
                    FaceValue = CardFaceValue.Jack, Suit = CardSuit.Spades
                },
                new Card()
                {
                    FaceValue = CardFaceValue.Jack, Suit = CardSuit.Clubs
                },
                new Card()
                {
                    FaceValue = CardFaceValue.Jack, Suit = CardSuit.Diamonds
                },
                new Card()
                {
                    FaceValue = CardFaceValue.Eight, Suit = CardSuit.Hearts
                },
                new Card()
                {
                    FaceValue = CardFaceValue.Four, Suit = CardSuit.Spades
                },
                new Card()
                {
                    FaceValue = CardFaceValue.HighAce, Suit = CardSuit.Hearts
                },
                new Card()
                {
                    FaceValue = CardFaceValue.HighAce, Suit = CardSuit.Spades
                },
                new Card()
                {
                    FaceValue = CardFaceValue.Four, Suit = CardSuit.Hearts
                },
                new Card()
                {
                    FaceValue = CardFaceValue.Queen, Suit = CardSuit.Hearts
                },
                new Card()
                {
                    FaceValue = CardFaceValue.King, Suit = CardSuit.Hearts
                },
                new Card()
                {
                    FaceValue = CardFaceValue.Five, Suit = CardSuit.Hearts
                }
            };

            var rule = new FullHouseRule();
            var hand = rule.BuildStrongestHand(cardList);

            Assert.IsNotNull(hand);
            Assert.AreEqual("Full House", hand.Name);
            Assert.AreEqual(700, hand.RankPrimary);
            Assert.AreEqual(61, hand.RankSecondry);


            Assert.IsTrue(hand.Cards.Any(x => x.FaceValue == CardFaceValue.Jack && x.Suit == CardSuit.Spades));
            Assert.IsTrue(hand.Cards.Any(x => x.FaceValue == CardFaceValue.Jack && x.Suit == CardSuit.Clubs));
            Assert.IsTrue(hand.Cards.Any(x => x.FaceValue == CardFaceValue.Jack && x.Suit == CardSuit.Diamonds));
            Assert.IsTrue(hand.Cards.Any(x => x.FaceValue == CardFaceValue.HighAce && x.Suit == CardSuit.Spades));
            Assert.IsTrue(hand.Cards.Any(x => x.FaceValue == CardFaceValue.HighAce && x.Suit == CardSuit.Hearts));
        }