Пример #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...");
     }
 }
Пример #2
0
 public void UpdateResidentialProperty(ResidentialProperty resident)
 {
     if (!ResidentialPropertyExists(resident.Id))
     {
         _dbContext.ResidentialProperties.Update(resident);
         _dbContext.SaveChanges();
     }
 }
        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);
        }
Пример #4
0
        private static void GetResidentialPropertyValue(ResidentialProperty 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;

            Console.WriteLine("Is property Joined Owned? ");
            Console.WriteLine("(1) Joined ");
            Console.WriteLine("(2) Not Joined ");
            //property.IsJoinedOwned = StampDutyHelper.GetInputFromConsole(1, 2, msg) == 1;

            Console.WriteLine("Is property second home?");
            Console.WriteLine("(1) FirstHome");
            Console.WriteLine("(2) SecondHome ");
            //property.IsAdditionalProperty = StampDutyHelper.GetInputFromConsole(1, 2, msg) == 2;
        }
Пример #5
0
 public void AddResidentialProperty(ResidentialProperty residentialProperty)
 {
     _dbContext.ResidentialProperties.Add(residentialProperty);
     _dbContext.SaveChanges();
 }
Пример #6
0
 public void AddResidentialProperty(ResidentialProperty residentialProperty)
 {
     throw new NotImplementedException();
 }