コード例 #1
0
        public void to_string_is_correct()
        {
            _residentialProperty.AddHouse();
            var toString = _residentialProperty.ToString();

            Assert.IsTrue(toString.Contains("\t Houses: 1"));
        }
コード例 #2
0
        public void developed_property_cant_be_mortgaged()
        {
            _residentialProperty = NewResidential();
            _residentialProperty.AddHouse();

            Assert.IsFalse(_residentialProperty.MortgageProperty());
        }
コード例 #3
0
        public void rent_for_property_with_one_house_is_correct()
        {
            _residentialProperty = NewResidential();
            _residentialProperty.AddHouse();
            const decimal rentPlusOneHouse = 28;
            var rentWithHouse = _residentialProperty.GetRent();

            Assert.AreEqual(rentPlusOneHouse, rentWithHouse);
        }
コード例 #4
0
        public void rent_for_property_with_one_house_is_correct()
        {
            _residentialProperty = NewResidential();
            _residentialProperty.AddHouse();
            const decimal rentPlusOneHouse = 28;
            var           rentWithHouse    = _residentialProperty.GetRent();

            Assert.AreEqual(rentPlusOneHouse, rentWithHouse);
        }
コード例 #5
0
        public void adding_hotel()
        {
            Board.Access().ResetBoard();
            _residentialProperty = NewResidential();

            for (var i = 0; i <= 4; i++)
            {
                _residentialProperty.AddHouse();
            }

            Assert.AreEqual(0, _residentialProperty.GetHouseCount());
            Assert.AreEqual(32, Board.Access().Houses);
            Assert.IsTrue(_residentialProperty.HasHotel);
        }
コード例 #6
0
        public void five_houses_equates_to_hotel()
        {
            _residentialProperty = NewResidential();

            // Shouldn't have houses or hotel to start with
            Assert.IsFalse(_residentialProperty.HasHotel);
            Assert.AreEqual(0, _residentialProperty.GetHouseCount());

            for (var i = 0; i <= 4; i++)
            {
                _residentialProperty.AddHouse();
            }

            Assert.IsTrue(_residentialProperty.HasHotel);
        }
コード例 #7
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());
        }
コード例 #8
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);
        }
コード例 #9
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);
        }
コード例 #10
0
 public void property_has_house_after_adding_house()
 {
     _residentialProperty = NewResidential();
     _residentialProperty.AddHouse();
     Assert.IsTrue(_residentialProperty.GetHouseCount() == 1);
 }
コード例 #11
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);
        }
コード例 #12
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);
        }
コード例 #13
0
        public void developed_property_cant_be_mortgaged()
        {
            _residentialProperty = NewResidential();
            _residentialProperty.AddHouse();

            Assert.IsFalse(_residentialProperty.MortgageProperty());
        }
コード例 #14
0
        public void adding_hotel()
        {
            Board.Access().ResetBoard();
            _residentialProperty = NewResidential();

            for (var i = 0; i <= 4; i++)
            {
                _residentialProperty.AddHouse();
            }

            Assert.AreEqual(0, _residentialProperty.GetHouseCount());
            Assert.AreEqual(32, Board.Access().Houses);
            Assert.IsTrue(_residentialProperty.HasHotel);
        }
コード例 #15
0
 public void property_has_house_after_adding_house()
 {
     _residentialProperty = NewResidential();
     _residentialProperty.AddHouse();
     Assert.IsTrue(_residentialProperty.GetHouseCount() == 1);
 }
コード例 #16
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());
        }
コード例 #17
0
        public void five_houses_equates_to_hotel()
        {
            _residentialProperty = NewResidential();

            // Shouldn't have houses or hotel to start with
            Assert.IsFalse(_residentialProperty.HasHotel);
            Assert.AreEqual(0, _residentialProperty.GetHouseCount());

            for (var i = 0; i <= 4; i++)   
            {
                _residentialProperty.AddHouse();
            }

            Assert.IsTrue(_residentialProperty.HasHotel);
        }