本文整理汇总了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);
}
示例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));
}
示例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));
}
示例4: IsFlushShouldThrowAnExceptionWhenAHandWithNullCardsIsPassed
public void IsFlushShouldThrowAnExceptionWhenAHandWithNullCardsIsPassed()
{
List<ICard> cards = null;
var checker = new PokerHandsChecker();
checker.IsFlush(new Hand(cards));
}
示例5: IsValidHandShouldThrowAnExceptionIfNullHandIsPassed
public void IsValidHandShouldThrowAnExceptionIfNullHandIsPassed()
{
IHand hand = null;
var checker = new PokerHandsChecker();
checker.IsValidHand(hand);
}
示例6: IsValidHandShouldThrowAnExceptionIfNullListOfCardsIsPassed
public void IsValidHandShouldThrowAnExceptionIfNullListOfCardsIsPassed()
{
List<ICard> cards = null;
var checker = new PokerHandsChecker();
checker.IsValidHand(new Hand(cards));
}
示例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);
}
示例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);
}
示例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));
}
示例10: TestStraightFlush
public void TestStraightFlush()
{
Hand hand = "J♣ 10♣ 9♣ 8♣ 7♣";
bool actual = new PokerHandsChecker().IsStraightFlush(hand);
Assert.AreEqual(true, actual);
}
示例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♣"));
}
示例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));
}
示例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));
}
示例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));
}
示例15: CompareHands_TestForNullCards_ShouldNotBeCorrect
public void CompareHands_TestForNullCards_ShouldNotBeCorrect()
{
IHand first = null;
IHand second = null;
var checker = new PokerHandsChecker();
checker.CompareHands(first,second);
}