예제 #1
0
        public void SellDevelopableLand_Developed_Unmortgaged()
        {
            int[] rentTable = new int[6] {
                4, 20, 60, 180, 320, 500
            };
            DevelopableLand gangstersParadise = new DevelopableLand("Gangsters Paradise",
                                                                    60, Colour.Brown, rentTable);

            // develop property with 1 house
            gangstersParadise.Develop();
            Assert.AreEqual(1, gangstersParadise.GetHouses());

            // check if property can be sold
            Assert.IsFalse(gangstersParadise.CanSellProperty());

            // cannot sell, must undevelop property first
            gangstersParadise.Undevelop();
            Assert.AreEqual(0, gangstersParadise.GetHouses());

            // unmortgaged property sells for original price value (£60)
            Assert.IsTrue(gangstersParadise.CanSellProperty());
            int sellingPrice = gangstersParadise.SellPropertyToBank();

            Assert.AreEqual(60, sellingPrice);
            // property is unowned after selling
            Assert.IsNull(gangstersParadise.GetOwner());
        }
예제 #2
0
        public void SellDevelopableLand_Mortgaged()
        {
            int[] rentTable = new int[6] {
                4, 20, 60, 180, 320, 450
            };
            DevelopableLand gangstersParadise = new DevelopableLand("Gangsters Paradise",
                                                                    60, Colour.Brown, rentTable);

            // mortgage property
            gangstersParadise.Mortgage();
            Assert.IsTrue(gangstersParadise.IsMortgaged());
            // mortgaged property sells for half price (£30)
            Assert.IsTrue(gangstersParadise.CanSellProperty());
            int sellingPrice = gangstersParadise.SellPropertyToBank();

            Assert.AreEqual(30, sellingPrice);
            // property is unowned and unmortgaged after selling
            Assert.IsNull(gangstersParadise.GetOwner());
            Assert.IsFalse(gangstersParadise.IsMortgaged());
        }