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


C# Deck.GetNextCard方法代码示例

本文整理汇总了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");
 }
开发者ID:tddold,项目名称:High-Quality-Code-Homeworks,代码行数:7,代码来源:TestDeck.cs

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

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

示例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");
        }
    }
开发者ID:danielpetrov,项目名称:DSA,代码行数:54,代码来源:StartUp.cs

示例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(); });
        }
开发者ID:TeeeeeC,项目名称:TelerikAcademy2015-2016,代码行数:12,代码来源:Tests.cs

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

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

示例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");
 }
开发者ID:tddold,项目名称:TelerikAcademyHomework,代码行数:8,代码来源:DeckTest.cs

示例9: TestDeckWhenHaveNoMoreCardsLeftToThrow

 public void TestDeckWhenHaveNoMoreCardsLeftToThrow(int cardsToDraw)
 {
     var deck = new Deck();
     for (int i = 0; i < cardsToDraw; i++)
     {
         deck.GetNextCard();
     }
 }
开发者ID:tddold,项目名称:TelerikAcademyHomework,代码行数:8,代码来源:DeckTest.cs

示例10: GetNextCardShouldThrowAnInternalGameExceptionWhenThereAreNoCardsLeftInTheDeck

 public void GetNextCardShouldThrowAnInternalGameExceptionWhenThereAreNoCardsLeftInTheDeck(int cardsToBeDrawn)
 {
     Deck testDeck = new Deck();
     for (int i = 0; i < cardsToBeDrawn; i++)
     {
         testDeck.GetNextCard();
     }
 }
开发者ID:plamenvt,项目名称:HighQualityCode,代码行数:8,代码来源:DeckTests.cs

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

示例12: ExpectToThrownWhenNoMoreCardsToGet

    public void ExpectToThrownWhenNoMoreCardsToGet(int numberOfCards)
    {
        var deck = new Deck();

        for (int i = 0; i <= numberOfCards; i++)
        {
            deck.GetNextCard();
        }
    }
开发者ID:DimitarGaydardzhiev,项目名称:TelerikAcademy,代码行数:9,代码来源:CardTests.cs

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

示例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");
        }
开发者ID:tddold,项目名称:TelerikAcademyHomework,代码行数:11,代码来源:DeckTest.cs

示例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!"));
        }
开发者ID:TeeeeeC,项目名称:TelerikAcademy2015-2016,代码行数:11,代码来源:Tests.cs


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