本文整理汇总了C#中Santase.Logic.Cards.Deck.GetNextCard方法的典型用法代码示例。如果您正苦于以下问题:C# Deck.GetNextCard方法的具体用法?C# Deck.GetNextCard怎么用?C# Deck.GetNextCard使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Santase.Logic.Cards.Deck
的用法示例。
在下文中一共展示了Deck.GetNextCard方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawNextCardFromEmptyDeckShouldThrowException
public void DrawNextCardFromEmptyDeckShouldThrowException(int cardsToBeDrawn)
{
var deck = new Deck();
for (int i = 0; i < cardsToBeDrawn; i++)
{
deck.GetNextCard();
}
Assert.Throws<InternalGameException>(() => deck.GetNextCard());
}
示例2: DeckTestGetNextCard24TimesShouldReturn24ValidCards
public void DeckTestGetNextCard24TimesShouldReturn24ValidCards()
{
var deck = new Deck();
for (int i = 0; i < cardsCount; i++)
{
var card = deck.GetNextCard();
Assert.IsTrue(Enum.IsDefined(typeof(CardSuit), deck.GetNextCard().Suit), "Invalid card suit: " + deck.GetTrumpCard.Suit.ToString() + "in position " + (i + 1));
Assert.IsTrue(Enum.IsDefined(typeof(CardType), deck.GetNextCard().Type), "Invalid card type: " + deck.GetTrumpCard.Type.ToString() + "in position " + (i + 1));
}
}
示例3: TestGetNextCardFromEmptyDeckThrowsException
public void TestGetNextCardFromEmptyDeckThrowsException()
{
var deck = new Deck();
int cardsCount = deck.CardsLeft;
Card card = deck.GetNextCard();
for (int i = 1; i <= cardsCount; i++)
{
card = deck.GetNextCard();
}
}
示例4: TestGettingCardsFromDeckShouldProperlyUpdateTheCountOfCardsLeft
public void TestGettingCardsFromDeckShouldProperlyUpdateTheCountOfCardsLeft(int countOfCardsToGet)
{
var deck = new Deck();
var card = deck.GetNextCard();
int cardsLeftCount = deck.CardsLeft;
for (int i = 1; i < countOfCardsToGet; i++)
{
card = deck.GetNextCard();
cardsLeftCount--;
}
Assert.AreEqual(deck.CardsLeft, cardsLeftCount);
}
示例5: ExpectTheTrumpCardToBeTakenLast
public void ExpectTheTrumpCardToBeTakenLast()
{
var deck = new Deck();
var trumpCard = deck.GetTrumpCard;
Card lastCard = deck.GetNextCard();
while (deck.CardsLeft > 0)
{
lastCard = deck.GetNextCard();
}
Assert.AreSame(trumpCard, lastCard);
}
示例6: TestChangeTrumpCardShouldProperlyUpdateBothTrumpCardAndDeckTopCard
public void TestChangeTrumpCardShouldProperlyUpdateBothTrumpCardAndDeckTopCard(CardSuit suit, CardType type)
{
Deck deck = new Deck();
Card newTrumpCard = new Card(suit, type);
deck.ChangeTrumpCard(newTrumpCard);
int cardsCount = deck.CardsLeft;
Card topCard = deck.GetNextCard();
for (int i = 1; i < cardsCount; i++)
{
topCard = deck.GetNextCard();
}
Assert.AreEqual(topCard, newTrumpCard);
}
示例7: CreatingNewDeckAndGetting23NextCardsAndThenChangingTrumpCardShouldReturnNextCardTheSameAsTrumpCard
public void CreatingNewDeckAndGetting23NextCardsAndThenChangingTrumpCardShouldReturnNextCardTheSameAsTrumpCard()
{
var deck = new Deck();
for (int i = 0; i < 23; i++)
{
var nextCard = deck.GetNextCard();
}
deck.ChangeTrumpCard(new Card(CardSuit.Spade, CardType.Ace));
var lastCard = deck.GetNextCard();
Assert.AreSame(lastCard, deck.GetTrumpCard);
}
示例8: ChangeTrumpCardShouldChangeTheLastCardInTheDeck
public void ChangeTrumpCardShouldChangeTheLastCardInTheDeck()
{
IDeck deck = new Deck();
var card = new Card(CardSuit.Club, CardType.Ace);
deck.ChangeTrumpCard(card);
var cardsCount = deck.CardsLeft;
for (var i = 0; i < cardsCount - 1; i++)
{
deck.GetNextCard();
}
var lastCard = deck.GetNextCard();
Assert.AreEqual(card, lastCard);
}
示例9: TestsIfCardRemovalWorks
public void TestsIfCardRemovalWorks()
{
Deck testDeck = new Deck();
int initialCardsCount = testDeck.CardsLeft;
testDeck.GetNextCard();
Assert.AreEqual((initialCardsCount - 1), testDeck.CardsLeft, "GetNextCard() should remove 1 card from the deck");
}
示例10: ExpectTrumpCardToBeCorrectAfterAChange
public void ExpectTrumpCardToBeCorrectAfterAChange()
{
var deck = new Deck();
var trumpCard = deck.GetNextCard();
deck.ChangeTrumpCard(trumpCard);
Assert.AreSame(deck.GetTrumpCard, trumpCard);
}
示例11: DeckTestGetNextCardShouldReturnValidCard
public void DeckTestGetNextCardShouldReturnValidCard()
{
var deck = new Deck();
var card = deck.GetNextCard();
Assert.IsTrue(Enum.IsDefined(typeof(CardSuit), card.Suit), "Invalid card suit: " + deck.GetTrumpCard.Suit.ToString());
Assert.IsTrue(Enum.IsDefined(typeof(CardType), card.Type), "Invalid card type: " + deck.GetTrumpCard.Type.ToString());
}
示例12: DeckTestGetNextCard25TimesShouldThrow
public void DeckTestGetNextCard25TimesShouldThrow()
{
var deck = new Deck();
for (int i = 0; i < cardsCount + 1; i++)
{
var card = deck.GetNextCard();
}
}
示例13: DeckShouldThrowAnExceptionWhenDrawingMoreCardsThanInTheDeck
public void DeckShouldThrowAnExceptionWhenDrawingMoreCardsThanInTheDeck()
{
var deck = new Deck();
for (int i = 1; i <= 25; i++)
{
deck.GetNextCard();
}
}
示例14: GetNextCardShouldNotChangeTheTrumpCard
public void GetNextCardShouldNotChangeTheTrumpCard()
{
IDeck deck = new Deck();
var trumpBefore = deck.TrumpCard;
deck.GetNextCard();
var trumpAfter = deck.TrumpCard;
Assert.AreEqual(trumpBefore, trumpAfter);
}
示例15: TestNextCardGotFromTheDeckIsNotNull
public void TestNextCardGotFromTheDeckIsNotNull()
{
Deck gameDeck = new Deck();
int initialCardsCount = gameDeck.CardsLeft;
Assert.Greater(initialCardsCount, 0);
Card nextCard = gameDeck.GetNextCard();
Assert.IsNotNull(nextCard);
}