本文整理汇总了C#中Deck.GetNextCard方法的典型用法代码示例。如果您正苦于以下问题:C# Deck.GetNextCard方法的具体用法?C# Deck.GetNextCard怎么用?C# Deck.GetNextCard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Deck
的用法示例。
在下文中一共展示了Deck.GetNextCard方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_DeckClassGetNextCardAndExpectToBeDifferent
public void Test_DeckClassGetNextCardAndExpectToBeDifferent()
{
var deck = new Deck();
var card = deck.GetNextCard();
var card2 = deck.GetNextCard();
Assert.AreNotEqual(card, card2, "Two consicative card are equal");
}
示例2: Test_DeckClassGetTooMuchCardsFromTheDeck
public void Test_DeckClassGetTooMuchCardsFromTheDeck()
{
var deck = new Deck();
var card = deck.GetNextCard();
for (var i = 0; i < 100; i++)
{
card = deck.GetNextCard();
}
}
示例3: Deck_TakeNewCard_ShouldThrowExeption
public void Deck_TakeNewCard_ShouldThrowExeption()
{
var deck = new Deck();
for (int i = 1; i <= 24; i++)
{
var card = deck.GetNextCard();
}
Assert.Throws<InternalGameException>(() => deck.GetNextCard());
}
示例4: Main
public static void Main()
{
List<Card> listOfCards = new List<Card>();
Deck deck = new Deck();
listOfCards.Add(deck.GetNextCard());
listOfCards.Add(deck.GetNextCard());
listOfCards.Add(deck.GetNextCard());
listOfCards.Add(deck.GetNextCard());
List<PlayingCard> playingCards = new List<PlayingCard>();
foreach (var card in listOfCards)
{
Console.WriteLine(card);
playingCards.Add(new PlayingCard(CardSuit.Club, card.Type));
}
playingCards.Add(new PlayingCard(CardSuit.Club, CardType.Five));
playingCards.Add(new PlayingCard(CardSuit.Club, CardType.Ace));
playingCards.Add(new PlayingCard(CardSuit.Club, CardType.Six));
playingCards.Add(new PlayingCard(CardSuit.Club, CardType.Seven));
playingCards.Add(new PlayingCard(CardSuit.Spade, CardType.Eight));
playingCards.Add(new PlayingCard(CardSuit.Club, CardType.Nine));
playingCards.Add(new PlayingCard(CardSuit.Club, CardType.King));
playingCards.Sort();
foreach (var card in playingCards)
{
Console.WriteLine(card.NominalValue);
//playingCards.Add(new PlayingCard(CardSuit.Club, card.Type));
}
//playingCards.Add(new PlayingCard(CardSuit.Diamond, CardType.Ten));
//playingCards.Add(new PlayingCard(CardSuit.Club, CardType.Five));
//playingCards.Add(new PlayingCard(CardSuit.Club, CardType.Six));
//playingCards.Sort();
HandEvaluateRaiseTwo pk = new HandEvaluateRaiseTwo();
if (pk.Rules[PokerHands.Pair](playingCards))
{
Console.WriteLine("pair");
}
if (pk.Rules[PokerHands.TwoPair](playingCards))
{
Console.WriteLine("twoPair");
}
if (pk.Rules[PokerHands.Flush](playingCards))
{
Console.WriteLine("flush");
}
if (pk.Rules[PokerHands.Straight](playingCards))
{
Console.WriteLine("straigth");
}
}
示例5: Getting24NextCardsLeftShoudThrowAnExcepetion
public void Getting24NextCardsLeftShoudThrowAnExcepetion(int count)
{
var deck = new Deck();
for (int i = 0; i < count; i++)
{
deck.GetNextCard();
}
Assert.Throws(typeof(ArgumentException),
() => { deck.GetNextCard(); });
}
示例6: TestIfGetNextCardRetunsACard
public void TestIfGetNextCardRetunsACard()
{
var deck = new Deck();
var card = deck.GetNextCard();
Assert.IsInstanceOf(typeof(Card), card, "The method does not return an instace of Card class");
}
示例7: GetNextCardShouldRemoveTheCardFromTheDeck
public void GetNextCardShouldRemoveTheCardFromTheDeck()
{
Deck testDeck = new Deck();
int initialNumberOfCards = testDeck.CardsLeft;
testDeck.GetNextCard();
Assert.AreEqual((initialNumberOfCards - 1), testDeck.CardsLeft, "GetNextCard() should remove 1 card from the deck");
}
示例8: TestIfDeckChangesTheTrumpCard
public void TestIfDeckChangesTheTrumpCard()
{
var deck = new Deck();
var initialTrumpCard = deck.GetTrumpCard;
var newCard = deck.GetNextCard();
deck.ChangeTrumpCard(newCard);
Assert.AreNotSame(initialTrumpCard, deck.GetTrumpCard, "The deck does not change trump card");
}
示例9: TestDeckWhenHaveNoMoreCardsLeftToThrow
public void TestDeckWhenHaveNoMoreCardsLeftToThrow(int cardsToDraw)
{
var deck = new Deck();
for (int i = 0; i < cardsToDraw; i++)
{
deck.GetNextCard();
}
}
示例10: GetNextCardShouldThrowAnInternalGameExceptionWhenThereAreNoCardsLeftInTheDeck
public void GetNextCardShouldThrowAnInternalGameExceptionWhenThereAreNoCardsLeftInTheDeck(int cardsToBeDrawn)
{
Deck testDeck = new Deck();
for (int i = 0; i < cardsToBeDrawn; i++)
{
testDeck.GetNextCard();
}
}
示例11: ChangeTrumpCardShouldChangeTheTrumpCardIfThereAreCardsLeftInTheDeck
public void ChangeTrumpCardShouldChangeTheTrumpCardIfThereAreCardsLeftInTheDeck()
{
Deck testDeck = new Deck();
Card initialTrumpCard = testDeck.GetTrumpCard;
Card newCard = testDeck.GetNextCard();
testDeck.ChangeTrumpCard(newCard);
Assert.AreNotSame(initialTrumpCard, testDeck.GetTrumpCard);
}
示例12: ExpectToThrownWhenNoMoreCardsToGet
public void ExpectToThrownWhenNoMoreCardsToGet(int numberOfCards)
{
var deck = new Deck();
for (int i = 0; i <= numberOfCards; i++)
{
deck.GetNextCard();
}
}
示例13: ChangeTrumpCardShouldChangeTheTrumpCard
public void ChangeTrumpCardShouldChangeTheTrumpCard()
{
var deck = new Deck();
var trumpCard = deck.GetTrumpCard;
var nextCard = deck.GetNextCard();
deck.ChangeTrumpCard(nextCard);
Assert.AreNotEqual(trumpCard, deck.GetTrumpCard);
}
示例14: TestDeckToHaveCorrectNumberOfCardsAfterDrawing
public void TestDeckToHaveCorrectNumberOfCardsAfterDrawing()
{
int expectedNumberOfCards = 20;
var deck = new Deck();
for (int i = 0; i < 4; i++)
{
deck.GetNextCard();
}
Assert.AreEqual(expectedNumberOfCards, deck.CardsLeft, "Number of cards during game is not correct");
}
示例15: GettingNextCardsLeftShoudProperlyWork
public void GettingNextCardsLeftShoudProperlyWork(int count)
{
var deck = new Deck();
for (int i = 0; i < count; i++)
{
deck.GetNextCard();
}
Assert.AreEqual(24 - count, deck.CardsLeft, string.Format("The deck must have count cards!"));
}