Пример #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 DevelopableLand_SellProperty()
        {
            int[] rentTable = new int[6] {
                60, 70, 80, 90, 100, 200
            };
            DevelopableLand ibisClose = new DevelopableLand("Ibis Close", 400, Colour.DeepBlue, rentTable);

            // sell property to bank
            Assert.AreEqual(400, ibisClose.SellPropertyToBank());

            // develop the property and attempt to sell it
            ibisClose.Develop();
            try
            {
                ibisClose.SellPropertyToBank();
            }
            catch (DevelopableLandException e)
            {
                Console.WriteLine(e.Message);
                Assert.AreEqual("Cannot sell the property while it is developed!", e.Message);
            }
        }
Пример #3
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());
        }