Ejemplo n.º 1
0
 public void To(FourPlayers players)
 {
     players.Player1.Hand().Add(_Deck.NextCard());
     players.Player2.Hand().Add(_Deck.NextCard());
     players.Player3.Hand().Add(_Deck.NextCard());
     players.Player4.Hand().Add(_Deck.NextCard());
 }
Ejemplo n.º 2
0
 public OhHellGame(FourPlayers players, IBiddings biddings, IDeck deck)
 {
     _Players = players;
     _Biddings = biddings;
     _Deck = deck;
     _Dealer = new Dealer();
 }
Ejemplo n.º 3
0
        public void DealDeckToPlayers()
        {
            var players = new FourPlayers();

            _Deck.Cards.Push(Queen.Of(Suit.Hearts));
            _Deck.Cards.Push(King.Of(Suit.Clubs));
            _Deck.Cards.Push(Two.Of(Suit.Diamonds));
            _Deck.Cards.Push(Six.Of(Suit.Spades));

            _Dealer.Deal(_Deck).To(players);

            //TODO Moq went nuts
            Assert.That(players.Player1.Hand(), Contains.Item(Six.Of(Suit.Spades)));
            Assert.That(players.Player2.Hand(), Contains.Item(Two.Of(Suit.Diamonds)));
            Assert.That(players.Player3.Hand(), Contains.Item(King.Of(Suit.Clubs)));
            Assert.That(players.Player4.Hand(), Contains.Item(Queen.Of(Suit.Hearts)));
        }
Ejemplo n.º 4
0
        public void PlayingSimpleHand()
        {
            var biddings = new Mock<IBiddings>();
            var players = new FourPlayers();
            IDeck deck = new Deck();

            SetupTrumpCard(deck, Queen.Of(Suit.Clubs));
            SetupDeckForPlayers(deck, new List<ICard> {Six.Of(Suit.Spades), Two.Of(Suit.Diamonds), Six.Of(Suit.Clubs), King.Of(Suit.Spades)});
            biddings.Setup(a => a.BidOf(players.Player1)).Returns(0);
            biddings.Setup(a => a.BidOf(players.Player2)).Returns(1);
            biddings.Setup(a => a.BidOf(players.Player3)).Returns(0);
            biddings.Setup(a => a.BidOf(players.Player4)).Returns(1);

            var game = new OhHellGame(players, biddings.Object, deck);

            game.NextRound();

            Assert.That(game.ScoreOf(players.Player1), Is.EqualTo(5));
            Assert.That(game.ScoreOf(players.Player2), Is.EqualTo(6));
            Assert.That(game.ScoreOf(players.Player3), Is.EqualTo(5));
            Assert.That(game.ScoreOf(players.Player4), Is.EqualTo(-5));
        }