Exemplo n.º 1
0
        public void player_doesnt_own_property_with_house()
        {
            Board.Access().ResetBoard();
            var property = new Residential("Test");

            property.SetOwner(ref _player1);

            Board.Access().AddProperty(property);

            _gameOfMonopoly.SellHouse(_player1);

            Assert.Pass();
        }
Exemplo n.º 2
0
        public void property_is_mortgaged()
        {
            var property = new Residential();

            property.SetOwner(ref _player1);
            property.MortgageProperty();

            Board.Access().AddProperty(property);

            _gameOfMonopoly.BuyHouse(_player1, property, true);

            Assert.AreEqual(0, property.GetHouseCount());
        }
Exemplo n.º 3
0
        public void adding_house()
        {
            Board.Access().ResetBoard();

            var property = new Residential("Test");

            property.SetOwner(ref _player1);
            Board.Access().AddProperty(property);

            _gameOfMonopoly.BuyHouse(_player1, property, true);

            Assert.AreEqual(1, property.GetHouseCount());
        }
Exemplo n.º 4
0
        public void player_doesnt_own_all_properties_of_colour()
        {
            var property  = new Residential("Test");
            var property2 = new Residential("Test2");

            property.SetOwner(ref _player1);

            Board.Access().AddProperty(property);
            Board.Access().AddProperty(property2);

            _gameOfMonopoly.BuyHouse(_player1, property, true);

            Assert.AreEqual(0, property.GetHouseCount());
        }
        public void rent_is_doubled_for_undeveloped_prop_single_owner_colour()
        {
            Board.Access().ResetBoard();
            var player = new Player("Josh");
            _residentialProperty = NewResidential();
            _residentialProperty.SetOwner(ref player);
            
            Board.Access().AddProperty(_residentialProperty);

            const decimal orginalRent = 14;
            const decimal expectedRent = orginalRent*2;
            var actualRent = _residentialProperty.GetRent();

            Assert.AreEqual(expectedRent, actualRent);
        }
        public void rent_is_not_doubled_for_undeveloped_prop_single_owner_colour_banker()
        {
            Board.Access().ResetBoard();
            var banker = Banker.Access();

            _residentialProperty = NewResidential();
            _residentialProperty.SetOwner(ref banker);

            Board.Access().AddProperty(_residentialProperty);

            const decimal orginalRent = 14;
            var           actualRent  = _residentialProperty.GetRent();

            Assert.AreEqual(orginalRent, actualRent);
        }
        public void rent_is_doubled_for_undeveloped_prop_single_owner_colour()
        {
            Board.Access().ResetBoard();
            var player = new Player("Josh");

            _residentialProperty = NewResidential();
            _residentialProperty.SetOwner(ref player);

            Board.Access().AddProperty(_residentialProperty);

            const decimal orginalRent  = 14;
            const decimal expectedRent = orginalRent * 2;
            var           actualRent   = _residentialProperty.GetRent();

            Assert.AreEqual(expectedRent, actualRent);
        }
Exemplo n.º 8
0
        public void property_cant_be_developed_further()
        {
            Board.Access().ResetBoard();

            var property  = new Residential("Test");
            var property2 = new Residential("Test2");

            property.SetOwner(ref _player1);
            property2.SetOwner(ref _player1);
            Board.Access().AddProperty(property);
            Board.Access().AddProperty(property2);

            property.AddHouse();

            _gameOfMonopoly.BuyHouse(_player1, property, true);

            Assert.AreEqual(1, property.GetHouseCount());
        }
        public void unmortgaging_property_results_in_correct_balance_alterations()
        {
            _residentialProperty = NewResidential();
            var testPlayer   = GetMeANewPlayer();
            var paybackValue = _residentialProperty.GetMortgageValue() + (_residentialProperty.GetMortgageValue() * 10 / 100);// mortgage plus 10%

            _residentialProperty.SetOwner(ref testPlayer);
            _residentialProperty.MortgageProperty();

            var ownerBalaceBeforeUnmortgage   = testPlayer.GetBalance();
            var bankerBalanceBeforeUnmortgage = Banker.Access().GetBalance();

            _residentialProperty.UnmortgageProperty();

            // The property's owner should have paid the mortgage payback value
            Assert.AreEqual(ownerBalaceBeforeUnmortgage - paybackValue, testPlayer.GetBalance());

            // The banker should have received the mortgage payback value
            Assert.AreEqual(bankerBalanceBeforeUnmortgage + paybackValue, Banker.Access().GetBalance());
        }
        public void mortgaging_property_results_in_correct_balance_alterations()
        {
            _residentialProperty = NewResidential();
            var testPlayer          = GetMeANewPlayer();
            var mortgageValue       = _residentialProperty.GetMortgageValue();
            var ownerBalanceBefore  = testPlayer.GetBalance();
            var bankerBalanceBefore = Banker.Access().GetBalance();

            _residentialProperty.SetOwner(ref testPlayer);

            _residentialProperty.MortgageProperty();

            // Property should now be mortgaged
            Assert.IsTrue(_residentialProperty.IsMortgaged);

            // The property's owner should have received the mortgage money
            Assert.AreEqual(ownerBalanceBefore + mortgageValue, testPlayer.GetBalance());

            // The banker should have paid the mortgage money
            Assert.AreEqual(bankerBalanceBefore - mortgageValue, Banker.Access().GetBalance());
        }
Exemplo n.º 11
0
        public void no_hotels_left()
        {
            Board.Access().ResetBoard();
            Board.Access().Hotels = 0;

            var property = new Residential("Test");

            property.SetOwner(ref _player1);

            for (var i = 0; i <= 3; i++)
            {
                property.AddHouse();
            }

            Board.Access().AddProperty(property);

            _gameOfMonopoly.BuyHouse(_player1, property, true);

            Assert.AreEqual(4, property.GetHouseCount());
            Assert.IsFalse(property.HasHotel);
        }
Exemplo n.º 12
0
        public void selling_house()
        {
            Board.Access().ResetBoard();

            var property = new Residential("Test");

            property.SetOwner(ref _player1);
            property.AddHouse();

            var playersBalanceBefore   = _player1.GetBalance();
            var expectedIncreaseAmount = property.GetHouseCost() / 2;

            Board.Access().AddProperty(property);

            _gameOfMonopoly.SellHouse(_player1, property);

            // Players balance should go up by half house cost
            Assert.AreEqual(playersBalanceBefore + expectedIncreaseAmount, _player1.GetBalance());
            // Property shouldn't have house anymore
            Assert.AreEqual(0, property.GetHouseCount());
            // Board's houses should be back to full
            Assert.AreEqual(32, Board.Access().Houses);
        }
        public void selling_house()
        {
            Board.Access().ResetBoard();

            var property = new Residential("Test");
            property.SetOwner(ref _player1);
            property.AddHouse();

            var playersBalanceBefore = _player1.GetBalance();
            var expectedIncreaseAmount = property.GetHouseCost()/2;
            
            Board.Access().AddProperty(property);

            _gameOfMonopoly.SellHouse(_player1, property);

            // Players balance should go up by half house cost
            Assert.AreEqual(playersBalanceBefore + expectedIncreaseAmount, _player1.GetBalance());
            // Property shouldn't have house anymore
            Assert.AreEqual(0, property.GetHouseCount());
            // Board's houses should be back to full
            Assert.AreEqual(32, Board.Access().Houses);
        }
        public void player_doesnt_own_property_with_house()
        {
            Board.Access().ResetBoard();
            var property = new Residential("Test");
            property.SetOwner(ref _player1);

            Board.Access().AddProperty(property);

            _gameOfMonopoly.SellHouse(_player1);

            Assert.Pass();
        }
        public void adding_house()
        {
            Board.Access().ResetBoard();

            var property = new Residential("Test");
            property.SetOwner(ref _player1);
            Board.Access().AddProperty(property);

            _gameOfMonopoly.BuyHouse(_player1, property, true);

            Assert.AreEqual(1, property.GetHouseCount());
        }
        public void no_hotels_left()
        {
            Board.Access().ResetBoard();
            Board.Access().Hotels = 0;

            var property = new Residential("Test");
            property.SetOwner(ref _player1);

            for (var i = 0; i <= 3; i++)
            {
                property.AddHouse();
            }

            Board.Access().AddProperty(property);

            _gameOfMonopoly.BuyHouse(_player1, property, true);

            Assert.AreEqual(4, property.GetHouseCount());
            Assert.IsFalse(property.HasHotel);
        }
        public void property_cant_be_developed_further()
        {
            Board.Access().ResetBoard();

            var property = new Residential("Test");
            var property2 = new Residential("Test2");
            property.SetOwner(ref _player1);
            property2.SetOwner(ref _player1);
            Board.Access().AddProperty(property);
            Board.Access().AddProperty(property2);

            property.AddHouse();

            _gameOfMonopoly.BuyHouse(_player1, property, true);

            Assert.AreEqual(1, property.GetHouseCount());
        }
        public void player_doesnt_own_all_properties_of_colour()
        {
            var property = new Residential("Test");
            var property2 = new Residential("Test2");

            property.SetOwner(ref _player1);

            Board.Access().AddProperty(property);
            Board.Access().AddProperty(property2);

            _gameOfMonopoly.BuyHouse(_player1, property, true);

            Assert.AreEqual(0, property.GetHouseCount());
        }
        public void unmortgaging_property_results_in_correct_balance_alterations()
        {
            _residentialProperty = NewResidential();
            var testPlayer = GetMeANewPlayer();
            var paybackValue = _residentialProperty.GetMortgageValue() + (_residentialProperty.GetMortgageValue() * 10 / 100);// mortgage plus 10%

            _residentialProperty.SetOwner(ref testPlayer);
            _residentialProperty.MortgageProperty();

            var ownerBalaceBeforeUnmortgage = testPlayer.GetBalance();
            var bankerBalanceBeforeUnmortgage = Banker.Access().GetBalance();

            _residentialProperty.UnmortgageProperty();

            // The property's owner should have paid the mortgage payback value
            Assert.AreEqual(ownerBalaceBeforeUnmortgage - paybackValue, testPlayer.GetBalance());

            // The banker should have received the mortgage payback value
            Assert.AreEqual(bankerBalanceBeforeUnmortgage + paybackValue, Banker.Access().GetBalance());
        }
        public void rent_is_not_doubled_for_undeveloped_prop_single_owner_colour_banker()
        {
            Board.Access().ResetBoard();
            var banker = Banker.Access();

            _residentialProperty = NewResidential();
            _residentialProperty.SetOwner(ref banker);

            Board.Access().AddProperty(_residentialProperty);

            const decimal orginalRent = 14;
            var actualRent = _residentialProperty.GetRent();

            Assert.AreEqual(orginalRent, actualRent);
        }
        public void property_is_mortgaged()
        {
            var property = new Residential();
            property.SetOwner(ref _player1);
            property.MortgageProperty();

            Board.Access().AddProperty(property);

            _gameOfMonopoly.BuyHouse(_player1, property, true);

            Assert.AreEqual(0, property.GetHouseCount());
        }
        public void mortgaging_property_results_in_correct_balance_alterations()
        {
            _residentialProperty = NewResidential();
            var testPlayer = GetMeANewPlayer();
            var mortgageValue = _residentialProperty.GetMortgageValue();
            var ownerBalanceBefore = testPlayer.GetBalance();
            var bankerBalanceBefore = Banker.Access().GetBalance();

            _residentialProperty.SetOwner(ref testPlayer);

            _residentialProperty.MortgageProperty();

            // Property should now be mortgaged
            Assert.IsTrue(_residentialProperty.IsMortgaged);

            // The property's owner should have received the mortgage money
            Assert.AreEqual(ownerBalanceBefore + mortgageValue, testPlayer.GetBalance());

            // The banker should have paid the mortgage money
            Assert.AreEqual(bankerBalanceBefore - mortgageValue, Banker.Access().GetBalance());
        }