public void DevelopableLand_CalculateTotalValue() { int[] rentTable = new int[6] { 30, 60, 100, 150, 200, 320 }; int price = 200; Colour group = Colour.Blue; DevelopableLand reyLane = new DevelopableLand("Rey Lane", price, group, rentTable); // total value = original price (unmortgaged, undeveloped) Assert.AreEqual(200, reyLane.CalculateTotalValue()); // mortgage undeveloped property reyLane.Mortgage(); Assert.IsTrue(reyLane.IsMortgaged()); // total value = original price / 2 Assert.AreEqual(100, reyLane.CalculateTotalValue()); // unmortgaged property reyLane.Unmortgage(); Assert.IsFalse(reyLane.IsMortgaged()); // develop property with 3 houses for (int i = 0; i < 3; i++) { reyLane.Develop(); } Assert.AreEqual(3, reyLane.GetHouses()); // get correct house price int housePrice = reyLane.GetDevelopCost(); Assert.AreEqual(50, housePrice); // total value = original price + (3 * houseprice) int correctTotal = 200 + (3 * 50); Assert.AreEqual(correctTotal, reyLane.CalculateTotalValue()); // mortgage property reyLane.Mortgage(); Assert.IsTrue(reyLane.IsMortgaged()); //total value = (original price / 2) + (3 * houseprice) int correctTotal2 = (200 / 2) + (3 * housePrice); Assert.AreEqual(correctTotal2, reyLane.CalculateTotalValue()); }
public void DevelopableLand_GetDevelopCost() { int[] rentTable = new int[6] { 60, 70, 80, 90, 100, 200 }; DevelopableLand ibisClose = new DevelopableLand("Ibis Close", 400, Colour.DeepBlue, rentTable); // Deep Blue houses = £200 Assert.AreEqual(Colour.DeepBlue, ibisClose.GetColourGroup()); Assert.AreEqual(200, ibisClose.GetDevelopCost()); DevelopableLand picardAvenue = new DevelopableLand("Picard Avenue", 260, Colour.Yellow, rentTable); // Yellow houses = £150 Assert.AreEqual(Colour.Yellow, picardAvenue.GetColourGroup()); Assert.AreEqual(150, picardAvenue.GetDevelopCost()); DevelopableLand pennyLane = new DevelopableLand("Penny Lane", 260, Colour.Orange, rentTable); // Orange houses = £100 Assert.AreEqual(Colour.Orange, pennyLane.GetColourGroup()); Assert.AreEqual(100, pennyLane.GetDevelopCost()); }