示例#1
0
        public void GetPlayerBalanceFromBankShouldEqual1500()
        {
            bank.AddAccount(car, 1500);

            var playerBalance = bank.GetPlayerBalance(car);

            Assert.AreEqual(1500, playerBalance);
        }
示例#2
0
        public void LandDebitsPlayerAccount()
        {
            var beforeLandCash = banker.GetPlayerBalance(player);

            luxuryTax.Land(player);

            Assert.AreEqual(luxuryTax.Rent, beforeLandCash - banker.GetPlayerBalance(player));
        }
        public void PlayerLandsOnUnownedUtility_PurchasesIt()
        {
            var cashBeforeVisit = banker.GetPlayerBalance(player);

            water.Land(player);

            Assert.AreEqual(((IOwnableProperty)water).Price, cashBeforeVisit - banker.GetPlayerBalance(player));
            Assert.IsTrue(player.OwnsProperty(water as IOwnableProperty));
        }
示例#4
0
        public void VisitCreditsPlayerBalance200Dollars()
        {
            var expectedIncrease = 200;
            var cashBeforeLand   = banker.GetPlayerBalance(player);

            go.Visit(player);

            Assert.AreEqual(expectedIncrease, banker.GetPlayerBalance(player) - cashBeforeLand);
        }
示例#5
0
        public void PlayerLandsOnLuxuryTax_Loses75Dollars()
        {
            banker.Credit(player, 175);
            var cashBeforeTurn = banker.GetPlayerBalance(player);

            board.AdvancePlayerOnBoard(player, 38);

            Assert.AreEqual(38, player.Location);
            Assert.AreEqual(75, cashBeforeTurn - banker.GetPlayerBalance(player));
        }
示例#6
0
        public void LandDebitsPlayerAccount200()
        {
            banker.Credit(player, 2000);
            var expectedTax    = 200;
            var beforeLandCash = banker.GetPlayerBalance(player);

            incomeTax.Land(player);

            Assert.AreEqual(expectedTax, beforeLandCash - banker.GetPlayerBalance(player));
        }
        public void PlayerPurchasesUnownedBalticOnLand()
        {
            var baltic         = board.GetNextSpace(2);
            var cashBeforeLand = banker.GetPlayerBalance(car);

            baltic.Land(car);

            Assert.IsTrue(car.OwnsProperty(baltic as IOwnableProperty));
            Assert.AreEqual(60, Math.Abs(cashBeforeLand - banker.GetPlayerBalance(car)));
            Assert.AreEqual(car, ((IOwnableProperty)baltic).Owner);
        }
示例#8
0
        public void PlayerAccountSuccessfullyCreated()
        {
            var newPlayer = new Player("newPlayer");

            banker.AddAccount(newPlayer, 9999);

            Assert.AreEqual(9999, banker.GetPlayerBalance(newPlayer));
        }
示例#9
0
        public void PlayerLandsOnGo_Collects200Dollars()
        {
            var cashBeforeLandOnGo = banker.GetPlayerBalance(playerCar);

            go.Land(playerCar);

            Assert.AreEqual(200, banker.GetPlayerBalance(playerCar) - cashBeforeLandOnGo);
        }
示例#10
0
        public void PlayerSpendsThreeTurnsInJailPays50ToGetOut()
        {
            var mockDice = new Mock <IDice>();

            mockDice.Setup(d => d.RollResults).Returns(3);
            mockDice.Setup(d => d.Doubles).Returns(false);

            var board        = new Board(banker, mockDice.Object);
            var turnHandler  = new TurnHandler(board, banker, mockDice.Object);
            var roundHandler = new RoundHandler(turnHandler);
            var testGame     = new Game(banker, roundHandler);


            var playerCar = testGame.CreatePlayerAccount("Car");

            board.SendPlayerToJail(playerCar);

            turnHandler = new TurnHandler(board, banker, mockDice.Object);
            List <TurnEventArgs> playerTurns = new List <TurnEventArgs>();

            turnHandler.TurnFinished += (s, e) => { if (e.Player.Equals(playerCar))
                                                    {
                                                        playerTurns.Add(e);
                                                    }
            };

            var jailLocation = 10;

            turnHandler.TakeTurn(playerCar, 0, 0);
            Assert.AreEqual(jailLocation, playerCar.Location);
            Assert.IsTrue(playerCar.InJail);
            Assert.AreEqual(1500, banker.GetPlayerBalance(playerCar));

            turnHandler.TakeTurn(playerCar, 1, 0);
            Assert.AreEqual(jailLocation, playerCar.Location);
            Assert.IsTrue(playerCar.InJail);
            Assert.AreEqual(1500, banker.GetPlayerBalance(playerCar));

            var cashBeforeTurn = banker.GetPlayerBalance(playerCar);
            var costSpace13    = 140;

            turnHandler.TakeTurn(playerCar, 2, 0);
            Assert.AreEqual(13, playerCar.Location);
            Assert.IsFalse(playerCar.InJail);
            Assert.AreEqual(costSpace13 + 50, cashBeforeTurn - banker.GetPlayerBalance(playerCar));
        }
示例#11
0
        public void PlayerWith1800LandsOnIncomeTax_Lose180Dollars()
        {
            banker.Credit(player, 300);
            var cashBeforeTurn = banker.GetPlayerBalance(player);

            board.AdvancePlayerOnBoard(player, 4);

            Assert.AreEqual(4, player.Location);
            Assert.AreEqual(180, cashBeforeTurn - banker.GetPlayerBalance(player));
        }
示例#12
0
        public void PlayerLandsOnGoToJail_EndsUpVisitingJailWithBalanceUnchanged()
        {
            var cashBeforeTurn = banker.GetPlayerBalance(playerCar);

            board.AdvancePlayerOnBoard(playerCar, 30);

            Assert.AreEqual(10, playerCar.Location);
            Assert.AreEqual(0, banker.GetPlayerBalance(playerCar) - cashBeforeTurn);
        }
示例#13
0
        public void PlayerLandsOnOwnedRailRoadPaysRent()
        {
            pennsylvaniaRailRoad.Land(game.CreatePlayerAccount("Horse"));
            var cashBeforeVisit = banker.GetPlayerBalance(player);

            pennsylvaniaRailRoad.Land(player);

            Assert.AreEqual(25, cashBeforeVisit - banker.GetPlayerBalance(player));
            Assert.IsFalse(player.OwnsProperty(pennsylvaniaRailRoad));
        }