Example #1
0
        public void EmptyDrawPileShouldBecomeReshuffleDiscardPile()
        {
            Stage stage = Stage.Unknown;

            Hand h1 = coordinator.PlayTurn(player1, out stage);
            Hand h2 = coordinator.PlayTurn(player2, out stage);

            if (stage == Stage.RoundEnd)
            {
                Result result = coordinator.Eval();
                if (h1.Card.Rank > h2.Card.Rank)
                {
                    Assert.True(result.Outcome == Outcome.RoundWin);
                    Assert.True(result.Winner != null);
                    Assert.True(result.Winner.Card.Rank == h1.Card.Rank);
                    Assert.True(result.Winner.Player.Equals(player1));
                }
                else if (h1.Card.Rank < h2.Card.Rank)
                {
                    Assert.True(result.Outcome == Outcome.RoundWin);
                    Assert.True(result.Winner != null);
                    Assert.True(result.Winner.Card.Rank == h2.Card.Rank);
                    Assert.True(result.Winner.Player.Equals(player2));
                }
                else
                {
                    Assert.True(result.Outcome == Outcome.Draw);
                    Assert.True(result.Winner == null);
                }
            }
        }
Example #2
0
        public void EmptyDrawPileShouldBecomeReshuffleDiscardPile()
        {
            //GameContext context = new GameContext(conf);
            int initialCount = 20;
            int drawCount    = player.Stash.DrawPile.Count();
            int discardCount = player.Stash.DiscardPile.Count();

            Assert.True(player.Stash.NumOwnedCards == initialCount);
            Assert.False(player.Stash.Empty);

            while (drawCount > 0)
            {
                player.Play();
                coordinator.Eval();
                drawCount    = player.Stash.DrawPile.Count();
                discardCount = player.Stash.DiscardPile.Count();
            }

            Assert.True(drawCount == 0);
            Assert.True(discardCount > drawCount);

            // after player has played piles should be as follows :
            // - draw pile = initial count (20 in this case)
            // - discard pile = 0
            player.Play();

            drawCount    = player.Stash.DrawPile.Count();
            discardCount = player.Stash.DiscardPile.Count();

            Assert.True(drawCount > 0); // minus one played card
            Assert.True(discardCount == 0);
        }