Beispiel #1
0
        public void ShouldHaveJustOneCard()
        {
            Hand h = new Hand("2H");

            Check.That(h.Cards.Count).Equals(1);
            Check.That(h.Cards[0].NumberValue).Equals(2);
            Check.That(h.Cards[0].Suit).Equals("H");
            //Assert.AreEqual(1, h.Cards.Count);
            //Assert.AreEqual(2, h.Cards[0].NumberValue);
            //Assert.AreEqual("H", h.Cards[0].Suit);
        }
Beispiel #2
0
        public void ShouldSplitTheStringOfCards()
        {
            var cards = new Hand("2H AS").Cards;

            Check.That(cards[0].NumberValue).Equals(2);
            Check.That(cards[0].Suit).Equals("H");
            Check.That(cards[1].NumberValue).Equals(14);
            Check.That(cards[1].Suit).Equals("S");

            //Assert.AreEqual(2, cards[0].NumberValue);
            //Assert.AreEqual("H", cards[0].Suit);
            //Assert.AreEqual(14, cards[1].NumberValue);
            //Assert.AreEqual("S", cards[1].Suit);
        }
Beispiel #3
0
        public List<Hand> GetHandsFor(int nbPlayers)
        {
            var hands = new List<Hand>(nbPlayers);

            for (var i = 0; i < nbPlayers; i++)
            {
                var h = new Hand();

                var index = 0;
                while (h.Cards.Count < 5)
                {
                    var card = Cards[i + index];
                    h.Cards.Add(card);
                    index = index + nbPlayers;
                }

                hands.Add(h);
            }
            return hands;
        }