Exemplo n.º 1
0
 public static void Start()
 {
     while (true)
     {
         Console.WriteLine("Residential or Non-Residential");
         Console.WriteLine("1: Residential. ");
         Console.WriteLine("2: Non-Residential");
         var msg  = $"[Enter option number:] (1 or 2)";
         var type = StampDutyHelper.GetInputFromConsole(1, 2, msg);
         if (type == 1)
         {
             var property = new ResidentialProperty();
             GetResidentialPropertyValue(property);
             var stampDuty = property.CalculateStampDuty();
             StampDutyHelper.PrintTax(stampDuty);
         }
         else
         {
             var property = new NonResidentialProperty();
             GetNonResidentialPropertyValue(property);
             var stampDuty = property.CalculateStampDuty();
             StampDutyHelper.PrintTax(stampDuty);
         }
         System.Console.WriteLine("Another Property...");
     }
 }
Exemplo n.º 2
0
 private static void GetNonResidentialPropertyValue(NonResidentialProperty property)
 {
     Console.WriteLine("What is the value of the property?");
     property.Price = Convert.ToDouble(Console.ReadLine());
     Console.WriteLine("Is property Freehold?");
     Console.WriteLine("(1) Freehold  ");
     Console.WriteLine("(2) Leasehold ");
     //property.IsFreehold = StampDutyHelper.GetInputFromConsole(1, 2, msg) == 1;
 }
        public void CalculateTax_Return_CorrectTax(double price, double expectedTax)
        {
            //arrange
            var property = new NonResidentialProperty();

            property.Price = price;
            //act
            var band = property.CalculateStampDuty();
            var sum  = band.Sum(x => x.Tax);

            //assert
            Assert.AreEqual(expectedTax, sum);
        }