public void LosersDontCollect()
        {
            banker.Pay(loser, banker.Money[loser] + 1);
            var playerMoney = banker.Money[player];

            payCard.Execute(player);

            Assert.IsTrue(banker.IsBankrupt(loser));
            Assert.AreEqual(playerMoney - 400, banker.Money[player]);
        }
Example #2
0
        public void TakeTurn(IPlayer player)
        {
            doublesCount = 0;

            realEstateHandler.HandleMortgages(player);

            do
            {
                RollAndMove(player);
            }while (CanGoAgain(player));

            if (!banker.IsBankrupt(player))
            {
                realEstateHandler.HandleMortgages(player);
            }
        }
Example #3
0
 public void Execute(IPlayer player)
 {
     foreach (var payer in players.Where(p => !banker.IsBankrupt(p)))
     {
         banker.Transact(payer, player, 50);
     }
 }
Example #4
0
        private void CheckForBankrupcies()
        {
            var reposessions = ownedSpaces.Keys.Where(o => Owned(o) && banker.IsBankrupt(ownedSpaces[o])).ToList();

            foreach (var repo in reposessions)
            {
                ownedSpaces[repo] = NO_OWNER;
            }
        }
Example #5
0
        public void BankruptPlayerDoesNotOwnSpaces()
        {
            BuyProperty();

            banker.Pay(player, banker.Money[player] + 1);
            var renterMoney = banker.Money[renter];

            ownableHandler.Land(renter, 0);

            Assert.IsTrue(banker.IsBankrupt(player));
            Assert.AreEqual(renterMoney - property.Price, banker.Money[renter]);
        }
        public void OnePlayerLosesInThreePlayerGame_OtherTwoKeepPlaying()
        {
            SetupGameWithPlayers(3);
            var loser = game.CurrentPlayer;

            banker.Pay(loser, banker.Money[loser] + 1);
            game.TakeTurn();

            Assert.IsTrue(banker.IsBankrupt(loser));
            Assert.IsFalse(game.Finished);
            Assert.AreEqual(2, game.NumberOfActivePlayers);
        }
        public void Execute(IPlayer player)
        {
            var ineligiblePlayers = banker.GetBankrupcies(players);

            players = players.Except(ineligiblePlayers);

            var count = 0;

            while (count < players.Count() && !banker.IsBankrupt(player))
            {
                banker.Transact(player, players.ElementAt(count++), 50);
            }
        }
        public void GoesBrokeBailingOutOfJail_DoesNotGo()
        {
            player.JailStrategy = new NeverPay();
            banker.Pay(player, banker.Money[player] - 1);
            jailHandler.Imprison(player);

            for (var i = 0; i < 3; i++)
            {
                turnHandler.TakeTurn(player);
            }

            Assert.IsTrue(banker.IsBankrupt(player));
            Assert.AreEqual(BoardConstants.JAIL_OR_JUST_VISITING, boardHandler.PositionOf[player]);
        }
Example #9
0
        private void ShiftToNextPlayer()
        {
            var newPointer = currentPlayerPointer;

            do
            {
                newPointer = newPointer.Next ?? players.First;

                if (newPointer == players.First)
                {
                    Round++;
                }
            } while (banker.IsBankrupt(newPointer.Value));

            currentPlayerPointer = newPointer;
            RemoveBankruptPlayers();
        }
 public void Constructor()
 {
     Assert.AreEqual(1500, banker.Money[player]);
     Assert.IsFalse(banker.IsBankrupt(player));
 }
Example #11
0
 public void BankruptWhilePaying()
 {
     banker.Pay(player, banker.Money[player] - 1);
     railroadCard.Execute(player);
     Assert.IsTrue(banker.IsBankrupt(player));
 }