本文整理汇总了C#中Deck.Find方法的典型用法代码示例。如果您正苦于以下问题:C# Deck.Find方法的具体用法?C# Deck.Find怎么用?C# Deck.Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Deck
的用法示例。
在下文中一共展示了Deck.Find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToString_WitheFormat_ReturnsExpectedCardRepresentation
public void ToString_WitheFormat_ReturnsExpectedCardRepresentation()
{
Deck deck = new Deck();
Card aceOfHearts = deck.Find(SuitName.Heart, ValueName.Ace);
Card aceOfDiamonds = deck.Find(SuitName.Diamond, ValueName.Ace);
Card aceOfClubs = deck.Find(SuitName.Club, ValueName.Ace);
Card aceOfSpades = deck.Find(SuitName.Spade, ValueName.Ace);
Assert.AreEqual("Ah", aceOfHearts.ToString("e"));
Assert.AreEqual("Ad", aceOfDiamonds.ToString("e"));
Assert.AreEqual("Ac", aceOfClubs.ToString("e"));
Assert.AreEqual("As", aceOfSpades.ToString("e"));
}
示例2: ToString_WithFormat_ReturnsExpectedCardRepresentation
public void ToString_WithFormat_ReturnsExpectedCardRepresentation()
{
Deck deck = new Deck();
Card aceOfHearts = deck.Find(SuitName.Heart, ValueName.Ace);
Card aceOfDiamonds = deck.Find(SuitName.Diamond, ValueName.Ace);
Card aceOfClubs = deck.Find(SuitName.Club, ValueName.Ace);
Card aceOfSpades = deck.Find(SuitName.Spade, ValueName.Ace);
Assert.AreEqual("A" + Convert.ToChar(3), aceOfHearts.ToString("s"));
Assert.AreEqual("A" + Convert.ToChar(4), aceOfDiamonds.ToString("s"));
Assert.AreEqual("A" + Convert.ToChar(5), aceOfClubs.ToString("s"));
Assert.AreEqual("A" + Convert.ToChar(6), aceOfSpades.ToString("s"));
}
示例3: GetHandDescription_WithRoyalFlush_ReturnsCorrectDescription
public void GetHandDescription_WithRoyalFlush_ReturnsCorrectDescription()
{
Deck deck = new Deck();
Card[] holeCards =
new []
{
deck.Find(SuitName.Heart, ValueName.Ace),
deck.Find(SuitName.Heart, ValueName.King)
};
Card[] boardCards =
new[]
{
deck.Find(SuitName.Heart, ValueName.Queen),
deck.Find(SuitName.Heart, ValueName.Jack),
deck.Find(SuitName.Heart, ValueName.Ten),
deck.Find(SuitName.Club, ValueName.Two),
deck.Find(SuitName.Spade, ValueName.Five)
};
HandEvaluatorWrapper handEvaluator = new HandEvaluatorWrapper();
string handDescription = handEvaluator.GetHandDescription(holeCards, boardCards);
Assert.IsFalse(string.IsNullOrEmpty(handDescription));
Assert.AreEqual("Straight Flush (Hearts) with Ace high", handDescription);
}