Esempio n. 1
0
        //----==== PRIVATE ====--------------------------------------------------------------------

        private void HighCardValues(IHand hand, HandRank rank)
        {
            var cardValues = (from card in hand.Cards
                              orderby card.HighValue
                              select card.HighValue).Distinct().ToList();

            rank.SetHighCardValues(cardValues);
        }
        public void HandRank_CompareTo_HighCardsAreGreater_DueToLongerList()
        {
            var test = new HandRank(HandRankEnum.HighCard)
            {
                RankHighCardValue = 8, RankSecondHighCardValue = 7, HighCardValue = 5
            };
            var test2 = new HandRank(HandRankEnum.HighCard)
            {
                RankHighCardValue = 8, RankSecondHighCardValue = 7, HighCardValue = 5
            };

            test.SetHighCardValues(new List <int> {
                9, 10, 7
            });
            test2.SetHighCardValues(new List <int> {
                9, 6, 10, 7
            });

            Assert.AreEqual(1, test.CompareTo(test2));
            Assert.AreEqual(-1, test2.CompareTo(test));
        }
        public void HandRank_CompareTo_AreEqual()
        {
            var test = new HandRank(HandRankEnum.HighCard)
            {
                RankHighCardValue = 8, RankSecondHighCardValue = 7, HighCardValue = 5
            };
            var test2 = new HandRank(HandRankEnum.HighCard)
            {
                RankHighCardValue = 8, RankSecondHighCardValue = 7, HighCardValue = 5
            };

            test.SetHighCardValues(new List <int> {
                9, 10, 7, 6, 4
            });
            test2.SetHighCardValues(new List <int> {
                9, 6, 10, 4, 7
            });

            Assert.AreEqual(0, test.CompareTo(test2));
            Assert.AreEqual(0, test2.CompareTo(test));
        }