本文整理汇总了C#中Hand.Sort方法的典型用法代码示例。如果您正苦于以下问题:C# Hand.Sort方法的具体用法?C# Hand.Sort怎么用?C# Hand.Sort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hand
的用法示例。
在下文中一共展示了Hand.Sort方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_CheckStraightHand_ShouldPass
public void Test_CheckStraightHand_ShouldPass()
{
var card1 = new SimpleCard(CardType.Two, Suit.Clubs);
var card2 = new SimpleCard(CardType.Three, Suit.Diamonds);
var card3 = new SimpleCard(CardType.Four, Suit.Hearts);
var card4 = new SimpleCard(CardType.Five, Suit.Spades);
var card5 = new SimpleCard(CardType.Six, Suit.Spades);
var hand = new Hand();
hand.Add(card1);
hand.Add(card2);
hand.Add(card3);
hand.Add(card4);
hand.Add(card5);
var sortedHand = hand.Sort();
var firstHand = new HandEvaluator(sortedHand);
var result = firstHand.EvaluateHand();
Assert.AreEqual(HandStrength.Straight, result);
}
示例2: Test_CheckFullHouseHand_ShouldPass
public void Test_CheckFullHouseHand_ShouldPass()
{
var card1 = new SimpleCard(CardType.Ace, Suit.Clubs);
var card2 = new SimpleCard(CardType.Ace, Suit.Diamonds);
var card3 = new SimpleCard(CardType.Ace, Suit.Hearts);
var card4 = new SimpleCard(CardType.Nine, Suit.Spades);
var card5 = new SimpleCard(CardType.Nine, Suit.Diamonds);
var hand = new Hand();
hand.Add(card1);
hand.Add(card2);
hand.Add(card3);
hand.Add(card4);
hand.Add(card5);
var sortedHand = hand.Sort();
var firstHand = new HandEvaluator(sortedHand);
var result = firstHand.EvaluateHand();
Assert.AreEqual(HandStrength.FullHouse, result);
}
示例3: Test_CheckHighCardHand_ShouldPass
public void Test_CheckHighCardHand_ShouldPass()
{
var card1 = new SimpleCard(CardType.Three, Suit.Clubs);
var card2 = new SimpleCard(CardType.Two, Suit.Diamonds);
var card3 = new SimpleCard(CardType.Seven, Suit.Hearts);
var card4 = new SimpleCard(CardType.Five, Suit.Spades);
var card5 = new SimpleCard(CardType.Nine, Suit.Diamonds);
var hand = new Hand();
hand.Add(card1);
hand.Add(card2);
hand.Add(card3);
hand.Add(card4);
hand.Add(card5);
var sortedHand = hand.Sort();
var firstHand = new HandEvaluator(sortedHand);
firstHand.EvaluateHand();
bool highCard = firstHand.HandValue.HighCard.Equals((int)card5.Type);
Assert.IsTrue(highCard);
}