private static void AssertSuccessPaySlipDetails(string firstName, string lastName, string payPeriod, decimal grossIncome, decimal incomeTax, decimal netIncome, decimal super, IPaySlipDetails paySlipDetails) { paySlipDetails.ShouldNotBeNull(); paySlipDetails.FullName.ShouldBe(firstName.Trim() + " " + lastName.Trim()); paySlipDetails.TaxPeriod.ShouldBe(payPeriod); paySlipDetails.GrossIncome.ShouldBe(grossIncome); paySlipDetails.IncomeTax.ShouldBe(incomeTax); paySlipDetails.NetIncome.ShouldBe(netIncome); paySlipDetails.Super.ShouldBe(super); }
public IPaySlipDetails GetPaySlip(ITaxStructure taxStructure) { IPaySlipDetails paySlipDetails = null; try { var employee = _mapper.Map <IEmployeeDetails, IEmployee>(_employeeDetails); var salarySlip = SalarySlip.CreateSalarySlip(employee.Salary, taxStructure); salarySlip.TaxPeriod = _employeeDetails.TaxPeriod; employee.SalarySlips.Add(salarySlip); paySlipDetails = _mapper.Map <IEmployee, IPaySlipDetails>(employee); } catch (Exception ex) { _employeeMonthlyPayslipAppContext.AddError( new EmployeeMonthlyPayslipAppError("EmployeePayDetailsService:GetPaySlip", new EmployeeMonthlyPayslipAppException("Error occured while processing pay slip", ex)) ); } return(paySlipDetails); }