public void TestInitialize() { _testEmployee = new EmployeeBusinessModel() { Id = 1, FirstName = "John", LastName = "Doe" }; _deductionBusinessLogic = new Mock <DeductionBusinessLogic>(); _paymentBusinessLogic = new PaymentBusinessLogic(_deductionBusinessLogic.Object); }
public List <DeductionBusinessModel> CreateDeductionsPerYearFromEmployee(EmployeeBusinessModel employee) { var deductions = new List <DeductionBusinessModel>(); // Generate Employee Benefit Deduction deductions.Add(CreateDeduction(employee, "Employee Benefit", _employeeBenefitDeductionPerYear)); // Generate Employee Benefit Deductions foreach (var dependent in employee.Dependents) { deductions.Add(CreateDeduction(dependent, $"Dependent Benefit ({dependent.FirstName} {dependent.LastName})", _dependentBenefitDeductionPerYear)); } return(deductions); }
public List <PaymentBusinessModel> GeneratePaymentsForEmployee(EmployeeBusinessModel employee) { var payments = new List <PaymentBusinessModel>(); for (int i = 0; i < _paymentsPerYear; i++) { var paycheck = new PaymentBusinessModel { InitialValue = _initialPaymentValue, Deductions = _deductionBusinessLogic.CreateDeductionsPerPaymentFromEmployee(employee, _paymentsPerYear) }; paycheck.Total = CalculatePaycheckTotal(paycheck); payments.Add(paycheck); } return(payments); }
private const decimal _discountValuePercent = 0.1M; // 10% off public List <DeductionBusinessModel> CreateDeductionsPerPaymentFromEmployee(EmployeeBusinessModel employee, int paymentsPerYear) { var deductions = new List <DeductionBusinessModel>(); // The cost of benefits is $1000 per year for each employee. There are 26 paychecks in a year. var employeeBenefitDeductionPerPayment = _employeeBenefitDeductionPerYear / paymentsPerYear; // Generate Employee Benefit Deduction deductions.Add(CreateDeduction(employee, "Employee Benefit", employeeBenefitDeductionPerPayment)); // The cost of benefits is $500 per year for each dependent. There are 26 paychecks in a year. var dependentBenefitDeductionPerPayment = _dependentBenefitDeductionPerYear / paymentsPerYear; // Generate Employee Benefit Deductions foreach (var dependent in employee.Dependents) { deductions.Add(CreateDeduction(dependent, $"Dependent Benefit ({dependent.FirstName} {dependent.LastName})", dependentBenefitDeductionPerPayment)); } return(deductions); }
public decimal GetYearlyPaymentForEmployee(EmployeeBusinessModel employee) { var payments = GeneratePaymentsForEmployee(employee); return(CalculatePaymentSum(payments)); }