Пример #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...");
     }
 }
        public void CalculateTax_Return_CorrectTax(double price, bool additionalProperty, double expectedTax)
        {
            //arrange
            var property = new ResidentialProperty
            {
                Price = price,
                IsAdditionalProperty = additionalProperty
            };
            //act
            var band = property.CalculateStampDuty();
            var sum  = band.Sum(x => x.Tax);

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