コード例 #1
0
        public void CanScoreStraight()
        {
            var hand = new Hand();

            new List <Card>
            {
                new Card(CardValue.Six, CardSuit.Hearts),
                new Card(CardValue.Four, CardSuit.Spades),
                new Card(CardValue.Three, CardSuit.Clubs),
                new Card(CardValue.Five, CardSuit.Spades),
                new Card(CardValue.Two, CardSuit.Diamonds)
            }
            .ForEach(card => hand.Draw(card));

            var scorer = new HandScorer(hand, new FiveCardPokerRanks().HandRanks);

            scorer.GetScore().Name.Should().Be("Straight");
        }
コード例 #2
0
        public void CanScoreFullHouse()
        {
            var hand = new Hand();

            new List <Card>
            {
                new Card(CardValue.Ace, CardSuit.Diamonds),
                new Card(CardValue.Ace, CardSuit.Clubs),
                new Card(CardValue.Ace, CardSuit.Spades),
                new Card(CardValue.Two, CardSuit.Hearts),
                new Card(CardValue.Two, CardSuit.Spades)
            }
            .ForEach(card => hand.Draw(card));

            var scorer = new HandScorer(hand, new FiveCardPokerRanks().HandRanks);

            scorer.GetScore().Name.Should().Be("Full house");
        }
コード例 #3
0
        public void CanScoreThreeOfAKind()
        {
            var hand = new Hand();

            new List <Card>
            {
                new Card(CardValue.Eight, CardSuit.Clubs),
                new Card(CardValue.Six, CardSuit.Spades),
                new Card(CardValue.Eight, CardSuit.Diamonds),
                new Card(CardValue.Queen, CardSuit.Spades),
                new Card(CardValue.Eight, CardSuit.Spades)
            }
            .ForEach(card => hand.Draw(card));

            var scorer = new HandScorer(hand, new FiveCardPokerRanks().HandRanks);

            scorer.GetScore().Name.Should().Be("Three of a kind");
        }
コード例 #4
0
        public void CanScoreFlush()
        {
            var hand = new Hand();

            new List <Card>
            {
                new Card(CardValue.Ace, CardSuit.Spades),
                new Card(CardValue.Six, CardSuit.Spades),
                new Card(CardValue.Ten, CardSuit.Spades),
                new Card(CardValue.Two, CardSuit.Spades),
                new Card(CardValue.Two, CardSuit.Spades)
            }
            .ForEach(card => hand.Draw(card));

            var scorer = new HandScorer(hand, new FiveCardPokerRanks().HandRanks);

            scorer.GetScore().Name.Should().Be("Flush");
        }
コード例 #5
0
        public void CanScoreFullHouse()
        {
            var hand = new Hand();

            new List<Card>
                {
                    new Card(CardValue.Ace, CardSuit.Diamonds),
                    new Card(CardValue.Ace, CardSuit.Clubs),
                    new Card(CardValue.Ace, CardSuit.Spades),
                    new Card(CardValue.Two, CardSuit.Hearts),
                    new Card(CardValue.Two, CardSuit.Spades)
                }
            .ForEach(card => hand.Draw(card));

            var scorer = new HandScorer(hand, new FiveCardPokerRanks().HandRanks);

            scorer.GetScore().Name.Should().Be("Full house");
        }
コード例 #6
0
        public void CanScoreFlush()
        {
            var hand = new Hand();

            new List<Card>
                {
                    new Card(CardValue.Ace, CardSuit.Spades),
                    new Card(CardValue.Six, CardSuit.Spades),
                    new Card(CardValue.Ten, CardSuit.Spades),
                    new Card(CardValue.Two, CardSuit.Spades),
                    new Card(CardValue.Two, CardSuit.Spades)
                }
            .ForEach(card => hand.Draw(card));

            var scorer = new HandScorer(hand, new FiveCardPokerRanks().HandRanks);

            scorer.GetScore().Name.Should().Be("Flush");
        }
コード例 #7
0
        public void CanScorePair()
        {
            var hand = new Hand();

            new List<Card>
                {
                    new Card(CardValue.Ace, CardSuit.Diamonds),
                    new Card(CardValue.Eight, CardSuit.Spades),
                    new Card(CardValue.Queen, CardSuit.Spades),
                    new Card(CardValue.Six, CardSuit.Spades),
                    new Card(CardValue.Queen, CardSuit.Clubs)
                }
            .ForEach(card => hand.Draw(card));

            var scorer = new HandScorer(hand, new FiveCardPokerRanks().HandRanks);

            scorer.GetScore().Name.Should().Be("Pair");
        }
コード例 #8
0
        public void CanScoreStraightFlush()
        {
            var hand = new Hand();

            new List<Card>
                {
                    new Card(CardValue.Two, CardSuit.Diamonds),
                    new Card(CardValue.Four, CardSuit.Diamonds),
                    new Card(CardValue.Three, CardSuit.Diamonds),
                    new Card(CardValue.Five, CardSuit.Diamonds),
                    new Card(CardValue.Six, CardSuit.Diamonds)
                }
            .ForEach(card => hand.Draw(card));

            var scorer = new HandScorer(hand, new FiveCardPokerRanks().HandRanks);

            scorer.GetScore().Name.Should().Be("Straight flush");
        }