private static void ValidateResult(decimal salary, CostPreviewContract result, decimal expectedCostOfBenefits)
 {
     Assert.AreEqual(expectedCostOfBenefits, result.CostOfBenefits,
                     "The calculated cost did not match expectations");
     Assert.AreEqual(expectedCostOfBenefits / Periods, result.BenefitCostPerPayPeriod,
                     "The calculated cost did not match expectations");
     Assert.AreEqual((salary - result.CostOfBenefits) / Periods, result.PayAfterBenefitsPerPeriod,
                     "The calculated cost did not match expectations");
 }
        public CostPreviewContract CalculateCost(Employee employee)
        {
            decimal cost;

            cost  = CalculateEmployee(employee);
            cost += CalculateSpouse(employee.Spouse);
            cost += CalculateDependents(employee.Dependents);

            int periods = _paySettingsRepo.GetPayPeriods(DateTime.Now.Year);

            CostPreviewContract costPreview = new CostPreviewContract
            {
                CostOfBenefits            = cost,
                EmployeeSalary            = employee.Salary,
                BenefitCostPerPayPeriod   = cost / periods,
                PayAfterBenefitsPerPeriod = (employee.Salary - cost) / periods
            };

            return(costPreview);
        }