Ejemplo n.º 1
0
        public void TestRemovePlayer()
        {
            Game        game   = new Game(new Player[] { new Player("XXX"), new Player("YYY") });
            StreetField field1 = ((StreetField)game.Fields[1]);

            field1.Buy(game.Players[0]);
            game.RemovePlayer(game.Players[0]);
            Assert.That(game.Players.Count(), Is.EqualTo(1));
            Assert.That(game.PlayerPos.Count(), Is.EqualTo(1));
            Assert.That(game.CurrentPlayer.Removed, Is.EqualTo(true));
            Assert.That(game.AuctionFields[0].Name, Is.EqualTo(FieldNames.OldKentRoad));
        }
Ejemplo n.º 2
0
        public void TestGameOver()
        {
            Game        game   = new Game(new Player[] { new Player("XXX"), new Player("YYY") });
            StreetField field1 = ((StreetField)game.Fields[1]);

            field1.Buy(game.Players[0]);
            game.Players[1].PayMoney(game.Players[1].Money);
            try
            {
                field1.OnEnter(game.Players[1]);
            }
            catch (BankruptException)
            {
                game.RemovePlayer(game.Players[1]);
                Assert.That(game.CurrentPlayer.Removed, Is.EqualTo(true));
            }
            Assert.That(game.IsGameOver, Is.EqualTo(true));
        }