Ejemplo n.º 1
0
        public void DoNotBuyUnaffordableRealEstate()
        {
            banker.Pay(player, banker.Money[player] - property.Price + 1);
            var money = banker.Money[player];

            ownableHandler.Land(player, 0);

            Assert.AreEqual(money, banker.Money[player]);
        }
        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]);
        }
Ejemplo n.º 3
0
        public void OnePlayerLosesInTwoPlayerGame_OtherPlayerWins()
        {
            SetupGameWithPlayers(2);
            var winner = game.CurrentPlayer;

            game.TakeTurn();
            var loser = game.CurrentPlayer;

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

            Assert.AreEqual(winner, game.Winner);
        }
        public void BuyIfAtLeast500OnHand()
        {
            player.OwnableStrategy = new BuyOrMortgageIf500();
            renter.OwnableStrategy = new BuyOrMortgageIf500();

            banker.Pay(player, banker.Money[player] - 499);
            var money = banker.Money[player];

            realEstateHandler.Land(player, 0);

            Assert.AreEqual(money, banker.Money[player]);

            banker.Collect(player, 1);
            money = banker.Money[player];
            realEstateHandler.Land(player, 0);

            Assert.AreEqual(money - 1, banker.Money[player]);

            realEstateHandler.DevelopProperties(player);
            money = banker.Money[renter];
            realEstateHandler.Land(renter, 0);

            Assert.AreEqual(money, banker.Money[renter]);

            banker.Collect(player, 1);
            realEstateHandler.DevelopProperties(player);
            money = banker.Money[renter];
            realEstateHandler.Land(renter, 0);

            Assert.AreEqual(money - 1, banker.Money[renter]);
        }
Ejemplo n.º 5
0
        public void Execute(IPlayer player)
        {
            var houses  = realEstateHandler.GetNumberOfHouses(player);
            var hotels  = realEstateHandler.GetNumberOfHotels(player);
            var payment = houses * houseCost + hotels * hotelPremium;

            banker.Pay(player, payment);
        }
Ejemplo n.º 6
0
        private void TestIncomeTaxWith(Int32 thisMuchMoney)
        {
            banker.Pay(player, banker.Money[player] - thisMuchMoney);
            incomeTax.LandOn(player);
            var paid = Math.Min(thisMuchMoney / IncomeTax.INCOME_TAX_PERCENTAGE_DIVISOR, IncomeTax.INCOME_TAX_FLAT_RATE);

            Assert.AreEqual(thisMuchMoney - paid, banker.Money[player], Convert.ToString(thisMuchMoney));
        }
Ejemplo n.º 7
0
        public void LosersDontPay()
        {
            banker.Pay(loser, banker.Money[loser] + 1);
            var playerMoney = banker.Money[player];

            collectCard.Execute(player);

            Assert.AreEqual(playerMoney + 400, banker.Money[player]);
        }
Ejemplo n.º 8
0
        private void Buy(IPlayer player, OwnableSpace ownableSpace)
        {
            banker.Pay(player, ownableSpace.Price);
            ownedSpaces[ownableSpace] = player;

            if (ownableSpace is Property)
            {
                SetMonopolyFlags(player, ownableSpace as Property);
            }
            else if (ownableSpace is Railroad)
            {
                SetRailroadCount(player);
            }
            else
            {
                SetBothUtilitiesOwnedFlag();
            }
        }
        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]);
        }
Ejemplo n.º 10
0
 public override void LandOn(IPlayer player)
 {
     banker.Pay(player, LUXURY_TAX);
 }
Ejemplo n.º 11
0
 private void Bail(IPlayer player)
 {
     banker.Pay(player, GameConstants.COST_TO_GET_OUT_OF_JAIL);
     turnsInJail.Remove(player);
 }
Ejemplo n.º 12
0
 public void PayOneHundred()
 {
     banker.Pay(player, 100);
     Assert.AreEqual(1400, banker.Money[player]);
 }
Ejemplo n.º 13
0
        public override void LandOn(IPlayer player)
        {
            var amountToPay = Math.Min(banker.Money[player] / INCOME_TAX_PERCENTAGE_DIVISOR, INCOME_TAX_FLAT_RATE);

            banker.Pay(player, amountToPay);
        }
Ejemplo n.º 14
0
 public void BankruptWhilePaying()
 {
     banker.Pay(player, banker.Money[player] - 1);
     railroadCard.Execute(player);
     Assert.IsTrue(banker.IsBankrupt(player));
 }
Ejemplo n.º 15
0
 public void Execute(IPlayer player)
 {
     banker.Pay(player, payment);
 }