コード例 #1
0
        public void NextRoundWinner()
        {
            var game = new Game40(UserNames);

            game.NewGame();

            game.Users[0].DrawPile.Push(new Card()
            {
                Value = 1
            });
            game.Users[1].DrawPile.Push(new Card()
            {
                Value = 2
            });
            game.Users[0].DrawPile.Push(new Card()
            {
                Value = 5
            });
            game.Users[1].DrawPile.Push(new Card()
            {
                Value = 5
            });

            game.DoRound();
            Assert.IsNull(game.RoundWinner);

            game.DoRound();
            Assert.AreEqual(game.Users[1], game.RoundWinner);
        }
コード例 #2
0
        public void TestFirstRound()
        {
            var game = new Game40(UserNames);

            game.NewGame();
            game.DoRound();

            Assert.AreEqual(2, game.Users.Count);
            foreach (var user in game.Users)
            {
                Assert.AreEqual(19, user.DrawPile.Count);
                Assert.IsNotNull(user.Played);
                Assert.AreEqual(0, user.DiscardPile.Count);
            }
        }
コード例 #3
0
        public void NoDrawPileUseDiscardPile()
        {
            var game = new Game40(UserNames);

            game.NewGame();
            foreach (var user in game.Users)
            {
                user.DiscardPile.AddToStackAndEmptySource(user.DrawPile);
            }

            game.DoRound();

            foreach (var user in game.Users)
            {
                Assert.AreEqual(19, user.DrawPile.Count);
                Assert.IsNotNull(user.Played);
                Assert.AreEqual(0, user.DiscardPile.Count);
            }
        }