當前位置: 首頁>>代碼示例>>C#>>正文


C# Cards.Deck類代碼示例

本文整理匯總了C#中Santase.Logic.Cards.Deck的典型用法代碼示例。如果您正苦於以下問題:C# Deck類的具體用法?C# Deck怎麽用?C# Deck使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Deck類屬於Santase.Logic.Cards命名空間,在下文中一共展示了Deck類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PlayShouldCallGetTurnAndEndTurnForBothPlayers

        public void PlayShouldCallGetTurnAndEndTurnForBothPlayers()
        {
            var firstPlayer = new ValidPlayer();
            var firstPlayerInfo = new RoundPlayerInfo(firstPlayer);
            var secondPlayer = new ValidPlayer();
            var secondPlayerInfo = new RoundPlayerInfo(secondPlayer);
            var stateManager = new StateManager();
            var deck = new Deck();

            SimulateGame(firstPlayerInfo, secondPlayerInfo, deck);

            var trick = new Trick(firstPlayerInfo, secondPlayerInfo, stateManager, deck, GameRulesProvider.Santase);
            var winner = trick.Play();

            Assert.AreEqual(1, firstPlayer.GetTurnCalledCount);
            Assert.AreEqual(1, secondPlayer.GetTurnCalledCount);
            Assert.AreEqual(1, firstPlayer.EndTurnCalledCount);
            Assert.AreEqual(1, secondPlayer.EndTurnCalledCount);

            Assert.IsNotNull(firstPlayer.GetTurnContextObject);
            Assert.IsNotNull(secondPlayer.GetTurnContextObject);
            Assert.IsNotNull(firstPlayer.EndTurnContextObject);
            Assert.IsNotNull(secondPlayer.EndTurnContextObject);

            Assert.IsNotNull(firstPlayer.EndTurnContextObject.FirstPlayedCard);
            Assert.IsNotNull(firstPlayer.EndTurnContextObject.SecondPlayedCard);
            Assert.IsNotNull(secondPlayer.EndTurnContextObject.FirstPlayedCard);
            Assert.IsNotNull(secondPlayer.EndTurnContextObject.SecondPlayedCard);

            Assert.IsTrue(winner == firstPlayerInfo || winner == secondPlayerInfo);
        }
開發者ID:NotDemons,項目名稱:NotDemonsRepo,代碼行數:31,代碼來源:TrickTestsForSantase.cs

示例2: ExpectTrumpCardToEqualSwappedCard

 public void ExpectTrumpCardToEqualSwappedCard()
 {
     var deck = new Deck();
     var card = new Card(CardSuit.Club, CardType.Ace);
     deck.ChangeTrumpCard(card);
     Assert.AreEqual(card, deck.GetTrumpCard);
 }
開發者ID:kiko81,項目名稱:Teleric-Academy-Homeworks,代碼行數:7,代碼來源:DeckTests.cs

示例3: ChangingTrumpCardShouldNotThrow

 public void ChangingTrumpCardShouldNotThrow()
 {
     Deck deck = new Deck();
     Card trumpCard = deck.GetTrumpCard;
     Card newCard = new Card(CardSuit.Heart, CardType.Nine);
     deck.ChangeTrumpCard(newCard);
 }
開發者ID:Rostech,項目名稱:TelerikAcademyHomeworks,代碼行數:7,代碼來源:DeckTests.cs

示例4: 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

示例5: 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

示例6: TestDeckChangeTrumpCard

 public void TestDeckChangeTrumpCard()
 {
     var card = new Card(CardSuit.Club, CardType.Jack);
     var deck = new Santase.Logic.Cards.Deck();
     deck.ChangeTrumpCard(card);
     Assert.AreEqual(card, deck.GetTrumpCard);
 }
開發者ID:SimoPrG,項目名稱:TelerikAcademyHomeworks,代碼行數:7,代碼來源:DeckNUnitTests.cs

示例7: 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

示例8: 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

示例9: ChangeTrumpCardShouldWorkProperly

 public void ChangeTrumpCardShouldWorkProperly()
 {
     IDeck deck = new Deck();
     var card = new Card(CardSuit.Spade, CardType.Nine);
     deck.ChangeTrumpCard(card);
     var trumpCard = deck.TrumpCard;
     Assert.AreEqual(card, trumpCard);
 }
開發者ID:NotDemons,項目名稱:NotDemonsRepo,代碼行數:8,代碼來源:DeckTests.cs

示例10: TestGetNextCardShouldRemoveTheCardFromTheDeck

        public void TestGetNextCardShouldRemoveTheCardFromTheDeck()
        {
            Deck deck = new Deck();
            int initialNumberOfCards = deck.CardsLeft;
            deck.GetNextCard();

            Assert.AreEqual((initialNumberOfCards - 1), deck.CardsLeft, "GetNextCard() should remove 1 card from the deck");
        }
開發者ID:g-yonchev,項目名稱:TelerikAcademy_2015_2016,代碼行數:8,代碼來源:TestDeck.cs

示例11: TestChangeWtihDifferentTrumps

        public void TestChangeWtihDifferentTrumps(string patternForCard)
        {
            Deck cards = new Deck();
            Card trump = GenerateCard(patternForCard);
            cards.ChangeTrumpCard(trump);

            Assert.AreEqual(trump.Type.ToFriendlyString() + trump.Suit.ToFriendlyString(), cards.GetTrumpCard.ToString());
        }
開發者ID:viktorD1m1trov,項目名稱:T-Academy,代碼行數:8,代碼來源:DeckTest.cs

示例12: GetNextCardThrowsAfterTakeCardFromEmptyDeck

 public void GetNextCardThrowsAfterTakeCardFromEmptyDeck(int count)
 {
     var deck = new Deck();
     for (int i = 0; i < count; i++)
     {
         deck.GetNextCard();
     }
 }
開發者ID:emilti,項目名稱:Telerik-Academy-My-Courses,代碼行數:8,代碼來源:DeckTest.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: GetNextCardShouldThrowExceptionIfGetNextCardIsCalledMoreThanTheNumberOfCardsInDeck

 public void GetNextCardShouldThrowExceptionIfGetNextCardIsCalledMoreThanTheNumberOfCardsInDeck()
 {
     var deck = new Deck();
     for (int i = 0; i <= CardsCount; i++)
     {
         deck.GetNextCard();
     }
 }
開發者ID:NK-Hertz,項目名稱:Telerik-Academy-2015,代碼行數:8,代碼來源:Class1.cs

示例15: 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


注:本文中的Santase.Logic.Cards.Deck類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。