Beispiel #1
0
        public void StandardDeckSerialization()
        {
            // Arrange
            var deck = new StandardCardDeck(MakeCardOptions());

            PutThroughPaces(deck);
            var settings = new JsonSerializerSettings
            {
                Formatting = Formatting.Indented
            };
            // Act
            var text    = JsonConvert.SerializeObject(deck, settings);
            var created = JsonConvert.DeserializeObject <StandardCardDeck>(text);
            // Assert
        }
Beispiel #2
0
        public void DealTexasHands()
        {
            // Arrange
            var deck = new StandardCardDeck(new PlayingCardOptions
            {
                AceMode = AceMode.High,
                Order   = PlayingCardSortOrder.PokerOrder,
                Hands   = new HandOptions {
                    InitialHandSize = 2
                },
                Discards = new DiscardOptions {
                    AutoShuffle = true
                },
                HasJokers = false
            });

            // Act
            // Assert
            deck.DrawPile.Shuffle();
            var hands = deck.Deal(10, 2);

            Assert.AreEqual(10, hands.Count());
            foreach (var hand in hands)
            {
                Assert.AreEqual(2, hand.Count);
            }
            Assert.AreEqual(32, deck.DrawPile.Count);
            Assert.AreEqual(0, deck.DiscardPile.Count);
            Assert.AreEqual(0, deck.Table.Count);
            Assert.AreEqual(52, deck.Count);

            hands.ElementAt(3).Muck();
            Assert.AreEqual(9, deck.Hands.Count);
            Assert.AreEqual(2, deck.DiscardPile.Count);
            Assert.AreEqual(32, deck.DrawPile.Count);
            Assert.AreEqual(52, deck.Count);

            deck.Muck();
            Assert.AreEqual(0, deck.Hands.Count);
            Assert.AreEqual(20, deck.DiscardPile.Count);
            Assert.AreEqual(32, deck.DrawPile.Count);
            Assert.AreEqual(52, deck.Count);
        }
Beispiel #3
0
        public void CreateStandardDeck()
        {
            // Arrange
            // Act
            var deck = new StandardCardDeck(new PlayingCardOptions
            {
                AceMode = AceMode.High,
                Order   = PlayingCardSortOrder.PokerOrder,
                Hands   = new HandOptions {
                    InitialHandSize = 5
                },
                Discards = new DiscardOptions {
                    AutoShuffle = true
                },
                HasJokers = false
            });

            // Assert
            Assert.AreEqual(52, deck.DrawPile.Count);
            Assert.AreEqual(0, deck.DiscardPile.Count);
        }