public void CalculateExemptionForRent684()
 {
     House house;
     Employee employee;
     uint u;
     house = new House();
     house.IsRented = true;
     house.Location = Location.NonMetro;
     house.MonthlyRent = 1u;
     employee = new Employee(3001u, 1, house);
     employee.Initialize();
     u = this.CalculateExemptionForRent(employee);
     Assert.AreEqual<uint>(360u, u);
 }
 public void CalculateExemptionForRent145()
 {
     House house;
     Employee employee;
     uint u;
     house = new House();
     house.IsRented = true;
     house.Location = Location.Metro;
     house.MonthlyRent = 2969603119u;
     employee = new Employee(uint.MaxValue, 1, house);
     employee.Initialize();
     u = this.CalculateExemptionForRent(employee);
     Assert.AreEqual<uint>(42949672u, u);
 }
 public void CalculateExemptionForRent129()
 {
     House house;
     Employee employee;
     uint u;
     house = new House();
     house.IsRented = true;
     house.Location = Location.Metro;
     house.MonthlyRent = 715478357u;
     employee = new Employee(1073741824u, 1, house);
     employee.Initialize();
     u = this.CalculateExemptionForRent(employee);
     Assert.AreEqual<uint>(0u, u);
 }
        public static uint CalculateExemptionForRent(
            Employee employee)
        {
            var taxExemption = default(uint);

            // Demo
            if(employee == null)
            {
                throw new ArgumentNullException("employee");
            }

            if (employee.Property.IsRented == false)
            {
                return taxExemption;
            }

            // Calculate location based allowance
            var locationAllowance = default(uint);
            switch (employee.Property.Location)
            {
                case Location.Metro:
                    locationAllowance = Convert.ToUInt32(Math.Ceiling(0.5 * employee.AnnualBasicSalary));
                    break;
                case Location.NonMetro:
                    locationAllowance = Convert.ToUInt32(Math.Ceiling(0.4 * employee.AnnualBasicSalary));
                    break;
                default:
                    throw new InvalidLocationException();
            }

            // Calculate default house rent allowance
            var defaultHRA = 12 * employee.Property.MonthlyRent - Convert.ToUInt32(Math.Ceiling(0.1 * employee.AnnualBasicSalary));

            // Calculate the minimum
            taxExemption = defaultHRA;
            if (locationAllowance < defaultHRA)
            {
                taxExemption = locationAllowance;
            }

            if (employee.AnnualHouseRentAllowance < taxExemption)
            {
                taxExemption = employee.AnnualHouseRentAllowance;
            }

            return taxExemption;
        }
 public static int CalculateExemptionForRule80C(
     Employee employee)
 {
     // TODO
     throw new NotImplementedException();
 }
 public void CalculateExemptionForRentThrowsInvalidLocationException252()
 {
     House house;
     Employee employee;
     uint u;
     house = new House();
     house.IsRented = true;
     house.Location = (Location)2;
     house.MonthlyRent = 1u;
     employee = new Employee(3001u, 1, house);
     employee.Initialize();
     u = this.CalculateExemptionForRent(employee);
 }
 public uint CalculateExemptionForRent(Employee employee)
 {
     uint result = TaxCalculator.CalculateExemptionForRent(employee);
     return result;
     // TODO: add assertions to method TaxCalculatorTest.CalculateExemptionForRent(Employee)
 }