Пример #1
0
        private static FiftyTwoCardGameDeck GetInitialDeck(IEnumerable <FiftyTwoCardGamePlayer> players)
        {
            var deck = new FiftyTwoCardGameDeck();

            foreach (var player in players)
            {
                deck.Put(player.Deck.Cards);
            }
            return(deck);
        }
        public void PutTests()
        {
            var sampleDeck = new FiftyTwoCardGameDeck();
            var card       = new FiftyTwoCardGameCard(Suite.Clubs, Face.Ace);

            sampleDeck.Put(card);

            Assert.AreEqual(sampleDeck.Cards.Count(), 1);
            Assert.AreEqual(sampleDeck.Cards.First(), card);
        }
Пример #3
0
        private static FiftyTwoCardGameDeck CreateDummy()
        {
            var deck = new FiftyTwoCardGameDeck();

            deck.Put(new List <FiftyTwoCardGameCard>
            {
                new FiftyTwoCardGameCard(Suite.Clubs, Face.Ace),
                new FiftyTwoCardGameCard(Suite.Spades, Face.Ace)
            });

            return(deck);
        }
        public void DrawMultipleTests()
        {
            var sampleDeck = new FiftyTwoCardGameDeck();
            var card       = new FiftyTwoCardGameCard(Suite.Clubs, Face.Ace);

            sampleDeck.Put(card);

            var drawnCards = sampleDeck.Draw(2).ToList();

            Assert.AreEqual(drawnCards.Count, 2);
            Assert.AreEqual(drawnCards.First(), card);
            Assert.IsNull(drawnCards.Last());
        }
        public void DrawSingleTests()
        {
            var sampleDeck = new FiftyTwoCardGameDeck();
            var card       = new FiftyTwoCardGameCard(Suite.Clubs, Face.Ace);

            sampleDeck.Put(card);

            var drawnCard      = sampleDeck.Draw();
            var secondDrawCard = sampleDeck.Draw();

            Assert.AreEqual(drawnCard, card);
            Assert.IsNull(secondDrawCard);
        }
Пример #6
0
        private static FiftyTwoCardGameDeck GetPlayerDeck(string[] cards)
        {
            var deck = new FiftyTwoCardGameDeck();

            foreach (var cardText in cards)
            {
                var cardInfos = cardText.Split(',');

                deck.Put(new FiftyTwoCardGameCard(Enum.Parse <Suite>(cardInfos[1], true),
                                                  Enum.Parse <Face>(cardInfos[0], true)));
            }

            return(deck);
        }
Пример #7
0
        private static FiftyTwoCardGameDeck CreateInitialShuffledDeck()
        {
            var deck = new FiftyTwoCardGameDeck();

            foreach (var suite in Enum.GetValues(typeof(Suite)))
            {
                foreach (var face in Enum.GetValues(typeof(Face)))
                {
                    deck.Put(new FiftyTwoCardGameCard((Suite)suite, (Face)face));
                }
            }
            deck.Shuffle();

            return(deck);
        }
        public void PutCollectionTests()
        {
            var sampleDeck = new FiftyTwoCardGameDeck();
            var cards      = new List <FiftyTwoCardGameCard>()
            {
                new FiftyTwoCardGameCard(Suite.Clubs, Face.Ace),
                new FiftyTwoCardGameCard(Suite.Spades, Face.Ace),
            };

            sampleDeck.Put(cards);

            Assert.AreEqual(sampleDeck.Cards.Count(), 2);
            Assert.AreEqual(sampleDeck.Cards.First(), cards[0]);
            Assert.AreEqual(sampleDeck.Cards.First(), cards[1]);
        }
Пример #9
0
 public void SetUp()
 {
     _moveControllerMock = new Mock <IMoveController <FiftyTwoCardGamePlayer, FiftyTwoCardGameDeck, FiftyTwoCardGameCard> >();
     _cardTray           = new Mock <ICardTray <FiftyTwoCardGamePlayer, FiftyTwoCardGameDeck, FiftyTwoCardGameCard> >();
     _cards = new List <FiftyTwoCardGameCard>()
     {
         new FiftyTwoCardGameCard(Suite.Clubs, Face.Ace),
         new FiftyTwoCardGameCard(Suite.Hearts, Face.Ten),
         new FiftyTwoCardGameCard(Suite.Hearts, Face.Ace),
     };
     _sampleDeck = new FiftyTwoCardGameDeck();
     _sampleDeck.Put(_cards);
     _jane = new FiftyTwoCardGamePlayer()
     {
         Name   = "Jane",
         Status = PlayerStatus.Competing,
         Deck   = _sampleDeck
     };
 }