コード例 #1
0
        public void RoyalFlush_Should_Beat_StraightFlush()
        {
            HandValue royalFlush = new HandValue(HandValue.HandType.RoyalFlush, 14, 13, 12, 11, 10);
            HandValue straightFlush = new HandValue(HandValue.HandType.FourOfAKind, 13, 12, 11, 10, 9);

            (royalFlush > straightFlush).Should().BeTrue();
        }
コード例 #2
0
        public void StraightFlush_Should_Beat_FourOfAKind()
        {
            HandValue straightFlush = new HandValue(HandValue.HandType.StraightFlush, 5, 4, 3, 2, 1);
            HandValue fourOfAKind = new HandValue(HandValue.HandType.FourOfAKind, 14, 14, 14, 14, 13);

            (straightFlush > fourOfAKind).Should().BeTrue();
        }
コード例 #3
0
        public void HighCard_Shouldnt_Beat_Pair()
        {
            HandValue highCard = new HandValue(HandValue.HandType.HighCard, 14, 12, 11, 10, 9);
            HandValue pair = new HandValue(HandValue.HandType.Pair, 2, 2, 3, 4, 5);

            (highCard > pair).Should().BeFalse();
        }
コード例 #4
0
        public void Pair_Should_Beat_HighCard()
        {
            HandValue pair = new HandValue(HandValue.HandType.Pair, 2, 2, 3, 4, 5);
            HandValue highCard = new HandValue(HandValue.HandType.HighCard, 14, 13, 12, 11, 9);

            (pair > highCard).Should().BeTrue();
        }
コード例 #5
0
        public void FourOfAKind_Should_Beat_FullHouse()
        {
            HandValue fourOfAKind = new HandValue(HandValue.HandType.FourOfAKind, 2, 2, 2, 2, 3);
            HandValue fullHouse = new HandValue(HandValue.HandType.FullHouse, 14, 14, 14, 13, 13);

            (fourOfAKind > fullHouse).Should().BeTrue();
        }
コード例 #6
0
        public void FullHouse_Should_Beat_Flush()
        {
            HandValue fullHouse= new HandValue(HandValue.HandType.FullHouse, 2, 2, 2, 3, 3);
            HandValue flush = new HandValue(HandValue.HandType.Flush, 14, 13, 12, 11, 9);

            (fullHouse > flush).Should().BeTrue();
        }
コード例 #7
0
        public void First_Kicker_Should_Be_Most_Relevant()
        {
            HandValue higherHighCardHandValue = new HandValue(HandValue.HandType.HighCard, 3, 2, 4, 5, 7);
            HandValue lowerHighCardHandValue = new HandValue(HandValue.HandType.HighCard, 2, 14, 13, 12, 11);

            (higherHighCardHandValue > lowerHighCardHandValue).Should().BeTrue();
        }
コード例 #8
0
        public void Flush_Should_Beat_Straight()
        {
            HandValue flush = new HandValue(HandValue.HandType.Flush, 7, 5, 4, 3, 2);
            HandValue straight = new HandValue(HandValue.HandType.Straight, 14, 13, 12, 11, 10);

            (flush > straight).Should().BeTrue();
        }
コード例 #9
0
        public void ThreeOfAKind_Should_Beat_TwoPair()
        {
            HandValue threeOfAKind = new HandValue(HandValue.HandType.ThreeOfAKind, 2, 2, 2, 3, 4);
            HandValue twoPair = new HandValue(HandValue.HandType.TwoPair, 14, 14, 13, 13, 12);

            (threeOfAKind > twoPair).Should().BeTrue();
        }
コード例 #10
0
        public void Straight_Should_Beat_ThreeOfAKind()
        {
            HandValue straight = new HandValue(HandValue.HandType.Straight, 5, 4, 3, 2, 1);
            HandValue threeOfAKind = new HandValue(HandValue.HandType.ThreeOfAKind, 14, 14, 14, 13, 12);

            (straight > threeOfAKind).Should().BeTrue();
        }
コード例 #11
0
        public void When_Same_Hand_Type_And_Kickers_Should_Be_Equal()
        {
            HandValue higherHighCardHandValue = new HandValue(HandValue.HandType.HighCard, 14, 8, 6, 5, 3);
            HandValue lowerHighCardHandValue = new HandValue(HandValue.HandType.HighCard, 14, 8, 6, 5, 3);

            higherHighCardHandValue.Should().Be(lowerHighCardHandValue);
            (higherHighCardHandValue == lowerHighCardHandValue).Should().BeTrue();
        }
コード例 #12
0
        public void When_Previous_Are_Equal_Third_Kicker_Should_Be_Most_Relevant()
        {
            HandValue higherHighCardHandValue = new HandValue(HandValue.HandType.HighCard, 2, 2, 3, 4, 5);
            HandValue lowerHighCardHandValue = new HandValue(HandValue.HandType.HighCard, 2, 2, 2, 14, 13);

            (higherHighCardHandValue > lowerHighCardHandValue).Should().BeTrue();
        }
コード例 #13
0
        public void When_Previous_Are_Equal_Fifth_Kicker_Should_Be_Most_Relevant()
        {
            HandValue higherHighCardHandValue = new HandValue(HandValue.HandType.HighCard, 14, 8, 6, 5, 3);
            HandValue lowerHighCardHandValue = new HandValue(HandValue.HandType.HighCard, 14, 8, 6, 5, 2);

            (higherHighCardHandValue > lowerHighCardHandValue).Should().BeTrue();
        }
コード例 #14
0
        public void TwoPair_Should_Beat_Pair()
        {
            HandValue twoPair = new HandValue(HandValue.HandType.TwoPair, 3, 3, 2, 2, 4);
            HandValue pair = new HandValue(HandValue.HandType.Pair, 14, 14, 13, 12, 11);

            (twoPair > pair).Should().BeTrue();
        }
コード例 #15
0
        private HandValue GetHandValue(HandValue.HandType handType, List<Card> handCards, List<Card> allCards)
        {
            List<Card> kickers = new List<Card>(handCards);

            allCards.RemoveAll(c => kickers.Contains(c));

            allCards = allCards.OrderByDescending(c => c.Number).ToList();

            while (kickers.Count < 5)
            {
                kickers.Add(allCards[0]);

                allCards.RemoveAt(0);
            }

            return new HandValue(handType, kickers.Select(c => c.Number).ToArray());
        }