当前位置: 首页>>代码示例>>C#>>正文


C# PokerHandsChecker类代码示例

本文整理汇总了C#中PokerHandsChecker的典型用法代码示例。如果您正苦于以下问题:C# PokerHandsChecker类的具体用法?C# PokerHandsChecker怎么用?C# PokerHandsChecker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PokerHandsChecker类属于命名空间,在下文中一共展示了PokerHandsChecker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: isValidHandShouldThrowExceptionWhenHandContainesNotEnoughtCards

 public void isValidHandShouldThrowExceptionWhenHandContainesNotEnoughtCards()
 {
     var handChecker = new PokerHandsChecker();
     var cards = new List<ICard>() { new Card(CardFace.Six, CardSuit.Clubs) };
     var hand = new Hand(cards);
     handChecker.IsValidHand(hand);
 }
开发者ID:antonpopov,项目名称:HighQualityCode,代码行数:7,代码来源:PokerHandsCheckerTest.cs

示例2: PokerHandCheckerIsFlushReturnsFalseIfItIsNot

        public void PokerHandCheckerIsFlushReturnsFalseIfItIsNot()
        {
            var handWithDiamondInBegining = new Hand(new List<ICard>() {
                new Card(CardFace.Ace, CardSuit.Diamonds),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Four, CardSuit.Spades),
                new Card(CardFace.Queen, CardSuit.Spades),
                new Card(CardFace.Eight, CardSuit.Spades),
            });

            var handWithDiamondInMiddle = new Hand(new List<ICard>() {
                new Card(CardFace.Ace, CardSuit.Spades),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Four, CardSuit.Diamonds),
                new Card(CardFace.Queen, CardSuit.Spades),
                new Card(CardFace.Eight, CardSuit.Spades),
            });

            var handWithDiamondInEnd = new Hand(new List<ICard>() {
                new Card(CardFace.Ace, CardSuit.Spades),
                new Card(CardFace.Jack, CardSuit.Spades),
                new Card(CardFace.Four, CardSuit.Spades),
                new Card(CardFace.Queen, CardSuit.Spades),
                new Card(CardFace.Eight, CardSuit.Diamonds),
            });

            var pokerHandChecker = new PokerHandsChecker();

            Assert.IsFalse(pokerHandChecker.IsFlush(handWithDiamondInBegining));
            Assert.IsFalse(pokerHandChecker.IsFlush(handWithDiamondInMiddle));
            Assert.IsFalse(pokerHandChecker.IsFlush(handWithDiamondInEnd));
        }
开发者ID:NK-Hertz,项目名称:Telerik-Academy-2015,代码行数:32,代码来源:UnitTest1.cs

示例3: Main

        static void Main()
        {
            ICard card = new Card(CardFace.Ace, CardSuit.Clubs);
            Console.WriteLine(card);

            IHand hand = new Hand(new List<ICard>() { 
                new Card(CardFace.Ace, CardSuit.Clubs),
                new Card(CardFace.Ace, CardSuit.Diamonds),
                new Card(CardFace.King, CardSuit.Hearts),
                new Card(CardFace.King, CardSuit.Spades),
                new Card(CardFace.Seven, CardSuit.Diamonds),
            });
            Console.WriteLine(hand);

            IPokerHandsChecker checker = new PokerHandsChecker();
            //Console.WriteLine(checker.IsValidHand(hand));
            //Console.WriteLine(checker.IsOnePair(hand));
            //Console.WriteLine(checker.IsTwoPair(hand));

            // vasil test
            IList<ICard> cards = new List<ICard>();
            cards.Add(new Card(CardFace.Ace, CardSuit.Diamonds));
            cards.Add(new Card(CardFace.Six, CardSuit.Diamonds));
            cards.Add(new Card(CardFace.Two, CardSuit.Diamonds));
            cards.Add(new Card(CardFace.Three, CardSuit.Diamonds));
            cards.Add(new Card(CardFace.Five, CardSuit.Diamonds));
            hand = new Hand(cards);
            Console.WriteLine(checker.IsStraightFlush(hand));
        }
开发者ID:ilkodzhambazov,项目名称:Telerik-Academy,代码行数:29,代码来源:PokerExample.cs

示例4: IsFlushShouldThrowAnExceptionWhenAHandWithNullCardsIsPassed

        public void IsFlushShouldThrowAnExceptionWhenAHandWithNullCardsIsPassed()
        {
            List<ICard> cards = null;
            var checker = new PokerHandsChecker();

            checker.IsFlush(new Hand(cards));
        }
开发者ID:AYankova,项目名称:HQC,代码行数:7,代码来源:PokerHandsCheckerIsFlushTests.cs

示例5: IsValidHandShouldThrowAnExceptionIfNullHandIsPassed

        public void IsValidHandShouldThrowAnExceptionIfNullHandIsPassed()
        {
            IHand hand = null;
            var checker = new PokerHandsChecker();

            checker.IsValidHand(hand);
        }
开发者ID:AYankova,项目名称:HQC,代码行数:7,代码来源:PokerHandsCheckerIsValidHandTests.cs

示例6: IsValidHandShouldThrowAnExceptionIfNullListOfCardsIsPassed

        public void IsValidHandShouldThrowAnExceptionIfNullListOfCardsIsPassed()
        {
            List<ICard> cards = null;
            var checker = new PokerHandsChecker();

            checker.IsValidHand(new Hand(cards));
        }
开发者ID:AYankova,项目名称:HQC,代码行数:7,代码来源:PokerHandsCheckerIsValidHandTests.cs

示例7: TestIsValidHand_WithNoCards

 public void TestIsValidHand_WithNoCards()
 {
     Hand currentHand = new Hand(new List<ICard>());
     PokerHandsChecker checker = new PokerHandsChecker();
     bool isValidHand = checker.IsValidHand(currentHand);
     Assert.AreEqual(false, isValidHand);
 }
开发者ID:quela,项目名称:myprojects,代码行数:7,代码来源:TestIsValidHand.cs

示例8: IsFlushShouldThrowAnExceptionWhenAnInvalidHandWithMoreCardsIsPassed

        public void IsFlushShouldThrowAnExceptionWhenAnInvalidHandWithMoreCardsIsPassed()
        {
            var cards = new List<ICard>() { new Card(CardFace.King, CardSuit.Spades), new Card(CardFace.King, CardSuit.Clubs), new Card(CardFace.Two, CardSuit.Clubs), new Card(CardFace.Three, CardSuit.Spades), new Card(CardFace.Four, CardSuit.Clubs), new Card(CardFace.Five, CardSuit.Clubs) };
            var hand = new Hand(cards);
            var checker = new PokerHandsChecker();

            checker.IsFlush(hand);
        }
开发者ID:AYankova,项目名称:HQC,代码行数:8,代码来源:PokerHandsCheckerIsFlushTests.cs

示例9: IsValidHandShouldReturnTrueIfValidHandIsPassed

        public void IsValidHandShouldReturnTrueIfValidHandIsPassed()
        {
            var cards = new List<ICard>() { new Card(CardFace.King, CardSuit.Spades), new Card(CardFace.Three, CardSuit.Clubs), new Card(CardFace.Two, CardSuit.Clubs), new Card(CardFace.Queen, CardSuit.Spades), new Card(CardFace.King, CardSuit.Diamonds) };
            var hand = new Hand(cards);
            var checker = new PokerHandsChecker();

            Assert.IsTrue(checker.IsValidHand(hand));
        }
开发者ID:AYankova,项目名称:HQC,代码行数:8,代码来源:PokerHandsCheckerIsValidHandTests.cs

示例10: TestStraightFlush

        public void TestStraightFlush()
        {
            Hand hand = "J♣ 10♣ 9♣ 8♣ 7♣";

            bool actual = new PokerHandsChecker().IsStraightFlush(hand);

            Assert.AreEqual(true, actual);
        }
开发者ID:dgrigorov,项目名称:TelerikAcademy-1,代码行数:8,代码来源:PokerHandsCheckerTests.cs

示例11: Main

        static void Main()
        {
            Console.WriteLine(new Card(CardFace.Ace, CardSuit.Clubs));

            IPokerHandsChecker checker = new PokerHandsChecker();

            //Console.WriteLine(checker.IsStraightFlush((Hand)"J♣ 10♣ 9♣ 8♣ 7♣"));
        }
开发者ID:dgrigorov,项目名称:TelerikAcademy-1,代码行数:8,代码来源:Program.cs

示例12: IsTwoPairShouldReturnFalseIfCardsAreHigh

        public void IsTwoPairShouldReturnFalseIfCardsAreHigh()
        {
            var cards = new List<ICard>() { new Card(CardFace.Ace, CardSuit.Clubs), new Card(CardFace.Ten, CardSuit.Clubs), new Card(CardFace.Nine, CardSuit.Spades), new Card(CardFace.Five, CardSuit.Diamonds), new Card(CardFace.Four, CardSuit.Diamonds) };
            var hand = new Hand(cards);
            var checker = new PokerHandsChecker();

            Assert.IsFalse(checker.IsTwoPair(hand));
        }
开发者ID:AYankova,项目名称:HQC,代码行数:8,代码来源:PokerHandsCheckerIsTwoPairTests.cs

示例13: IsFourOfAKindShouldReturnFalseWhenOnePairIsPassed

        public void IsFourOfAKindShouldReturnFalseWhenOnePairIsPassed()
        {
            var checker = new PokerHandsChecker();
            var cards = new List<ICard> { new Card(CardFace.Four, CardSuit.Spades), new Card(CardFace.Four, CardSuit.Diamonds), new Card(CardFace.Six, CardSuit.Hearts), new Card(CardFace.Seven, CardSuit.Hearts), new Card(CardFace.Four, CardSuit.Hearts) };
            var hand = new Hand(cards);

            Assert.IsFalse(checker.IsFourOfAKind(hand));
        }
开发者ID:AYankova,项目名称:HQC,代码行数:8,代码来源:PokerHandsCheckerIsFourOfAKindTests.cs

示例14: IsFullHouseShouldReturnFalseIfCardsAreThreeOfAKind

        public void IsFullHouseShouldReturnFalseIfCardsAreThreeOfAKind()
        {
            var cards = new List<ICard>() { new Card(CardFace.Ace, CardSuit.Clubs), new Card(CardFace.Ace, CardSuit.Spades), new Card(CardFace.Ace, CardSuit.Hearts), new Card(CardFace.Five, CardSuit.Diamonds), new Card(CardFace.Three, CardSuit.Spades) };
            var hand = new Hand(cards);
            var checker = new PokerHandsChecker();

            Assert.IsFalse(checker.IsFullHouse(hand));
        }
开发者ID:AYankova,项目名称:HQC,代码行数:8,代码来源:PokerHandsCheckerIsFullHouseTests.cs

示例15: CompareHands_TestForNullCards_ShouldNotBeCorrect

        public void CompareHands_TestForNullCards_ShouldNotBeCorrect()
        {
            IHand first = null;
            IHand second = null;
            var checker = new PokerHandsChecker();

            checker.CompareHands(first,second);
        }
开发者ID:deskuuu,项目名称:TelerikAcademy,代码行数:8,代码来源:PokerHandsCheckerTests.cs


注:本文中的PokerHandsChecker类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。