Example #1
0
        public void TestEmployeeDeductionWithDependents()
        {
            decimal cost;
            var     employee1 = new Employee("Anna", "Jones");

            cost = DeductionCalculator.CalculateDeductionCost(employee1);
            Assert.IsTrue(employeeDeduction * .10M == cost);
            employee1.AddDependent(new Dependent(DependentType.Spouse, "John", "Doe"));

            DependentDeductionCalculator d = new DependentDeductionCalculator();

            cost = employeeDeduction * .10M + d.CalculateDeduction("John");

            Assert.IsTrue(cost == DeductionCalculator.CalculateDeductionCost(employee1));
        }
Example #2
0
        public void TestEmployeeDeductionWithMultipleDependents()
        {
            decimal cost;
            decimal cost1;
            decimal cost2;
            DependentDeductionCalculator d = new DependentDeductionCalculator();
            var employee1 = new Employee("Anna", "Jones");

            cost = DeductionCalculator.CalculateDeductionCost(employee1);
            Assert.IsTrue(employeeDeduction * .10M == cost);
            employee1.AddDependent(new Dependent(DependentType.Spouse, "Amy", "Doe"));
            cost1 = d.CalculateDeduction("Amy");

            employee1.AddDependent(new Dependent(DependentType.Spouse, "Antoine", "Doe"));
            cost2 = d.CalculateDeduction("Antoine");


            Assert.IsTrue((employeeDeduction * .10M) + (2 * (dependentDeduction * .10M)) == DeductionCalculator.CalculateDeductionCost(employee1));
        }