Exemplo n.º 1
0
        public void PlayerPaysRentToOwnerWhenBothUtilitiesAreOwned()
        {
            var startingMoney = new Money(100);
            var owner         = new Player("car", startingMoney);
            var player        = new Player("horse", startingMoney);
            var fakeProperty  = new FakeProperty(owner: owner);
            var fakeDice      = new FakeDice();

            fakeDice.LoadRoll(3, 7);
            fakeDice.Roll();
            var expectedRent        = new Money(10 * fakeDice.LastRoll.Total);
            var expectedOwnerMoney  = startingMoney.Add(expectedRent);
            var expectedPlayerMoney = startingMoney.Remove(expectedRent);
            var rentAction          = new UtilityRentAction(new FakeBoard(numberOfUtilitiesOwned: 2), fakeDice);

            rentAction.ProcessAction(player, fakeProperty);

            Assert.AreEqual(expectedOwnerMoney, owner.Balance);
            Assert.AreEqual(expectedPlayerMoney, player.Balance);
        }
Exemplo n.º 2
0
        public void TakeTurnReturnsNewTurnWithNewLocationFromBoard()
        {
            var turnOrder   = 0;
            var newLocation = 10;

            fakeDice.LoadRoll(4, 6);

            var turn = turnService.Take(TurnOrder, player, board, fakeDice);

            Assert.AreEqual(turnOrder, turn.TurnOrder);
            Assert.AreEqual(player.Name, turn.PlayerName);
            Assert.AreEqual(newLocation, turn.EndingLocation);
        }