当前位置: 首页>>代码示例>>C#>>正文


C# Deck.GetNextCard方法代码示例

本文整理汇总了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());
 }
开发者ID:studware,项目名称:Ange-Git,代码行数:9,代码来源:DeckTest.cs

示例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));
     }
 }
开发者ID:damy90,项目名称:Telerik-all,代码行数:10,代码来源:DeckTests.cs

示例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();
     }
 }
开发者ID:Ivorankov,项目名称:High-Quality-Programing-Code,代码行数:10,代码来源:DeckTest.cs

示例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);
 }
开发者ID:kiko81,项目名称:Teleric-Academy-Homeworks,代码行数:12,代码来源:DeckTests.cs

示例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);
        }
开发者ID:SimoPrG,项目名称:HighQualityCodeHomework,代码行数:13,代码来源:DeckTests.cs

示例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);
 }
开发者ID:studware,项目名称:Ange-Git,代码行数:13,代码来源:DeckTests.cs

示例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);
        }
开发者ID:AYankova,项目名称:HQC,代码行数:14,代码来源:DeckTests.cs

示例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);
        }
开发者ID:NotDemons,项目名称:NotDemonsRepo,代码行数:14,代码来源:DeckTests.cs

示例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");
 }
开发者ID:Hris21,项目名称:High-Quality-Code,代码行数:7,代码来源:DeckTests.cs

示例10: ExpectTrumpCardToBeCorrectAfterAChange

 public void ExpectTrumpCardToBeCorrectAfterAChange()
 {
     var deck = new Deck();
     var trumpCard = deck.GetNextCard();
     deck.ChangeTrumpCard(trumpCard);
     Assert.AreSame(deck.GetTrumpCard, trumpCard);
 }
开发者ID:radenkovn,项目名称:Telerik-Homework,代码行数:7,代码来源:DeckClassTests.cs

示例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());
 }
开发者ID:damy90,项目名称:Telerik-all,代码行数:7,代码来源:DeckTests.cs

示例12: DeckTestGetNextCard25TimesShouldThrow

 public void DeckTestGetNextCard25TimesShouldThrow()
 {
     var deck = new Deck();
     for (int i = 0; i < cardsCount + 1; i++)
     {
         var card = deck.GetNextCard();
     }
 }
开发者ID:damy90,项目名称:Telerik-all,代码行数:8,代码来源:DeckTests.cs

示例13: DeckShouldThrowAnExceptionWhenDrawingMoreCardsThanInTheDeck

 public void DeckShouldThrowAnExceptionWhenDrawingMoreCardsThanInTheDeck()
 {
     var deck = new Deck();
     for (int i = 1; i <= 25; i++)
     {
         deck.GetNextCard();
     }
 }
开发者ID:zondario,项目名称:TelerikAcademy-Homeworks,代码行数:8,代码来源:DeckTests.cs

示例14: GetNextCardShouldNotChangeTheTrumpCard

 public void GetNextCardShouldNotChangeTheTrumpCard()
 {
     IDeck deck = new Deck();
     var trumpBefore = deck.TrumpCard;
     deck.GetNextCard();
     var trumpAfter = deck.TrumpCard;
     Assert.AreEqual(trumpBefore, trumpAfter);
 }
开发者ID:NotDemons,项目名称:NotDemonsRepo,代码行数:8,代码来源:DeckTests.cs

示例15: TestNextCardGotFromTheDeckIsNotNull

 public void TestNextCardGotFromTheDeckIsNotNull()
 {
     Deck gameDeck = new Deck();
     int initialCardsCount = gameDeck.CardsLeft;
     Assert.Greater(initialCardsCount, 0);
     Card nextCard = gameDeck.GetNextCard();
     Assert.IsNotNull(nextCard);
 }
开发者ID:studware,项目名称:Ange-Git,代码行数:8,代码来源:DeckTests.cs


注:本文中的Santase.Logic.Cards.Deck.GetNextCard方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。