Payroll Service
Generates the employee monthly pay slip
Application Design
PayrollService is the main project to receive the command for the commandline
It validates the input with the correct pattern i.e GenerateMonthlyPayslip "Mary Song" 60000
It will produce the output i.e
Monthly Payslip for: "Mary Song"
Gross Monthly Income: $5000
Monthly Income Tax: $500
Net Monthly Income: $4500
If not valid will throw InvalidInputException which will handle by the app to show the output
There is a Model of EmployeePaySlip that is a main entity of the payroll domain, it is inherated from the Payroll class that is implementing IPayroll interface. By doing so we have decouple on Payslip business logic from Employee class by following (OCP - Open Close Principal) also by implementing interface it will allow to mock the object. This extensibility feature will provide the ability to create different payslip generators of the different periods.
A separate TaxSlab class introduced as a value object which can define the tax slab
1.TaxableIncomeStartValue ie. $20,000
2.TaxableIncomeEndValue ie. $40,0000
3.TaxRate i.e 10%
4.Taxable i.e true/false
5.By setting the TaxableIncomeEndValue to zero will mark it as the max slab
6.It can calculate the TaxOnIncome per the slab
7.It can detect income is valid for slab
8.This slab class can be fetched from repository/cache to build the TaxSlabs for the payslip
Payslip class can return
1.GrossMonthlyIncome
2.MonthlyIncomeTax
3.NetMonthlyIncomeTax
4.LoadTaxSlabs (from any source)
PayrollService.UnitTest
It provide the 100% coverage using the xUnit and Coverlet to gernerate coverage report
There are two unit tests
1.TaxSlab to validate (Return_Tax_Description, Return_Tax_On_Income, Return_With_In_TaxSlab_Status)
2.Employee to validate (Return_Gross_Monthly_Income, Return_Monthly_Income_Tax, Return_Net_Monthly_Income_Tax)