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


C# Poker.Card类代码示例

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


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

示例1: ToStringAceOfSpadesTest

 public void ToStringAceOfSpadesTest()
 {
     Card card = new Card(CardFace.Ace, CardSuit.Spades);
     string actual = card.ToString();
     string expected = "A♠";
     Assert.AreEqual(actual, expected);
 }
开发者ID:hristian-dimov,项目名称:TelerikAcademy,代码行数:7,代码来源:CardTest.cs

示例2: TestToStringAceOfClubs

        public void TestToStringAceOfClubs()
        {
            Card card = new Card(CardFace.Ace, CardSuit.Clubs);
            string result = "A" + this.club;

            Assert.AreEqual(card.ToString(), result);
        }
开发者ID:VyaraGGeorgieva,项目名称:TelerikAcademy,代码行数:7,代码来源:TestCard.cs

示例3: TestToStringQueenOfSpades

        public void TestToStringQueenOfSpades()
        {
            Card card = new Card(CardFace.Queen, CardSuit.Spades);
            string result = "Q" + this.spade;

            Assert.AreEqual(card.ToString(), result);
        }
开发者ID:VyaraGGeorgieva,项目名称:TelerikAcademy,代码行数:7,代码来源:TestCard.cs

示例4: CardToStringTestTwoOfSpades

 public void CardToStringTestTwoOfSpades()
 {
     Card card = new Card(CardFace.Two, CardSuit.Spades);
     string expected = "2♠";
     string actual = card.ToString();
     Assert.AreEqual(expected, actual);
 }
开发者ID:kinira,项目名称:DevelopmentTools,代码行数:7,代码来源:CardTests.cs

示例5: Card_ToString_ShouldReturnCorrectFace_Jack

 public void Card_ToString_ShouldReturnCorrectFace_Jack()
 {
     Card card = new Card(CardFace.Jack, CardSuit.Clubs);
     var cardToString = card.ToString();
     var length = cardToString.Length;
     Assert.AreEqual("Jack", cardToString.Substring(0, 4));
 }
开发者ID:VDGone,项目名称:TelerikAcademy-1,代码行数:7,代码来源:CardTests.cs

示例6: Main

        static void Main()
        {
            Console.BackgroundColor = ConsoleColor.White;
            Console.ForegroundColor = ConsoleColor.Black;
            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),
            });

            IHand hand2 = new Hand(new List<ICard>() 
            { 
                new Card(CardFace.Two, CardSuit.Clubs),
                new Card(CardFace.Two, CardSuit.Diamonds),
                new Card(CardFace.Three, CardSuit.Hearts),
                new Card(CardFace.Three, CardSuit.Spades),
                new Card(CardFace.Two, CardSuit.Hearts),
            });

            Console.WriteLine(hand);

            IPokerHandsChecker checker = new PokerHandsChecker();
            Console.WriteLine("Is valid hand: " + checker.IsValidHand(hand));
            Console.WriteLine("Is one pair: " + checker.IsOnePair(hand));
            Console.WriteLine("Is two pairs: " + checker.IsTwoPair(hand));

            Console.WriteLine(Environment.NewLine + "Compare hands. 1 for first hand. -1 for second hand. 0 for same hands");
            Console.WriteLine("Hand: {0}, Hand2: {1} Compare: {2}", hand, hand2, checker.CompareHands(hand, hand2));
        }
开发者ID:VyaraGGeorgieva,项目名称:TelerikAcademy,代码行数:35,代码来源:PokerExample.cs

示例7: CardToStringTestNineOfClubs

 public void CardToStringTestNineOfClubs()
 {
     Card card = new Card(CardFace.Nine, CardSuit.Clubs);
     string expected = "9♣";
     string actual = card.ToString();
     Assert.AreEqual(expected, actual);
 }
开发者ID:kinira,项目名称:DevelopmentTools,代码行数:7,代码来源:CardTests.cs

示例8: TestCardShouldCompareCorrectly_DifferentCards

        public void TestCardShouldCompareCorrectly_DifferentCards()
        {
            var cardA = new Card(CardFace.Jack, CardSuit.Clubs);
            var cardB = new Card(CardFace.Ace, CardSuit.Hearts);

            Assert.IsFalse(cardA.Equals(cardB));
        }
开发者ID:Hri100v,项目名称:Telerik-Academy,代码行数:7,代码来源:CardTest.cs

示例9: TestCardShouldCompareCorrectly_EqualCards

        public void TestCardShouldCompareCorrectly_EqualCards()
        {
            var cardA = new Card(CardFace.Jack, CardSuit.Clubs);
            var cardB = new Card(CardFace.Jack, CardSuit.Clubs);

            Assert.IsTrue(cardA.Equals(cardB));
        }
开发者ID:Hri100v,项目名称:Telerik-Academy,代码行数:7,代码来源:CardTest.cs

示例10: 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.IsStraight(hand));
            Console.WriteLine(checker.IsOnePair(hand));
            Console.WriteLine(checker.IsTwoPair(hand));
            Console.WriteLine(checker.IsStraightFlush(hand));
            Console.WriteLine(checker.IsFlush(hand));
            Console.WriteLine(checker.IsFourOfAKind(hand));
            Console.WriteLine(checker.IsThreeOfAKind(hand));
            Console.WriteLine(checker.IsHighCard(hand));
            Console.WriteLine(checker.IsFullHouse(hand));
        }
开发者ID:vladislav-karamfilov,项目名称:TelerikAcademy,代码行数:26,代码来源:PokerExample.cs

示例11: Main

        internal 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.IsTwoPairs(hand));

            int a = 5;
            int b = 6;

            Console.WriteLine(b.CompareTo(a));
        }
开发者ID:Nottyy,项目名称:TelerikAcademy,代码行数:25,代码来源:PokerExample.cs

示例12: TestCompareHandsFirstHand

 public void TestCompareHandsFirstHand()
 {
     Card cardOne = new Card(CardFace.Ace, CardSuit.Diamonds);
     Card cardTwo = new Card(CardFace.Ace, CardSuit.Hearts);
     Card cardThree = new Card(CardFace.Five, CardSuit.Spades);
     Card cardFour = new Card(CardFace.Ace, CardSuit.Clubs);
     Card cardFive = new Card(CardFace.Ace, CardSuit.Spades);
     IList<ICard> cardsOne = new List<ICard>();
     cardsOne.Add(cardOne);
     cardsOne.Add(cardTwo);
     cardsOne.Add(cardThree);
     cardsOne.Add(cardFour);
     cardsOne.Add(cardFive);
     Hand handOne = new Hand(cardsOne);
     Card cardSix = new Card(CardFace.Two, CardSuit.Diamonds);
     Card cardSeven = new Card(CardFace.Jack, CardSuit.Hearts);
     Card cardEight = new Card(CardFace.Five, CardSuit.Spades);
     Card cardNine = new Card(CardFace.Ace, CardSuit.Clubs);
     Card cardTen = new Card(CardFace.Ten, CardSuit.Clubs);
     IList<ICard> cardsTwo = new List<ICard>();
     cardsTwo.Add(cardSix);
     cardsTwo.Add(cardSeven);
     cardsTwo.Add(cardEight);
     cardsTwo.Add(cardNine);
     cardsTwo.Add(cardTen);
     Hand handTwo = new Hand(cardsTwo);
     PokerHandsChecker poker = new PokerHandsChecker();
     int result = poker.CompareHands(handOne, handTwo);
     Assert.AreEqual(1, result, "CompareHands() method in class PokerHandsChecker is not working correctly.");
 }
开发者ID:danielkaradaliev,项目名称:TelerikAcademyAssignments,代码行数:30,代码来源:CompareHandsTests.cs

示例13: ToStringThreeOfHearts

 public void ToStringThreeOfHearts()
 {
     Card card = new Card(CardFace.Three, CardSuit.Hearts);
     string actual = card.ToString();
     string expected = "3♥";
     Assert.AreEqual(actual, expected);
 }
开发者ID:hristian-dimov,项目名称:TelerikAcademy,代码行数:7,代码来源:CardTest.cs

示例14: ToStringJackOfClubs

 public void ToStringJackOfClubs()
 {
     Card card = new Card(CardFace.Jack, CardSuit.Clubs);
     string actual = card.ToString();
     string expected = "J♣";
     Assert.AreEqual(actual, expected);
 }
开发者ID:hristian-dimov,项目名称:TelerikAcademy,代码行数:7,代码来源:CardTest.cs

示例15: PokerTestToStringSevenDiamonds

        public void PokerTestToStringSevenDiamonds()
        {
            Card myCard = new Card(CardFace.Seven, CardSuit.Diamonds);
            string result = myCard.ToString();

            Assert.AreEqual("7♦", result);
        }
开发者ID:ekostadinov,项目名称:CoursesProjects,代码行数:7,代码来源:CardToStringTest.cs


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