Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using WNPayroll.TaxCalcs;
- using WNPayroll.Zenith.Models.Data.Payroll;
- using Xunit;
- using Zenith.Business.Engine;
- using Zenith.Models.Data.Payroll.PayData;
- using SubTaxType = WNPayroll.Zenith.Models.Data.Enums.SubTaxType;
- namespace Zenith.UnitTests.Test_Cases
- {
- public class FUTATests
- {
- private readonly PayrollEngineV2 Engine = new PayrollEngineV2();
- private ZenithPayrollData PD = new ZenithPayrollData();
- private readonly Boolean W42020Tests = false;
- private readonly States StateTested = States.CA;
- /* Monthly = 1
- * Semi-weekly = 2 */
- private readonly short Default_FederalTaxDueFrequency = 1;
- [Fact]
- public void P53()
- {
- PD = TestDefaults.ResetPayrollData(StateTested);
- PD.Employees[0].PayDataRecords[0] = TestDefaults.DefaultRecord(25, 40);
- // CA State
- PD.Employees[0].StateTaxes.Add(new EmployeeStateTax()
- {
- TaxID = 2,
- State = StateTested,
- CompanyTaxDueFrequency = Default_FederalTaxDueFrequency
- });
- // Allowances and filing status are stored in Parameters in EmployeeStateTax class so we have to add them here outside
- // Parameters is a list of decimals (later cast into their appropriate types, sensitive to list index)
- /* Filing Status: SingleOrMarriedMultipleIncomes = 1, MarriedOneIncome = 2, HeadOfHousehold = 4 */
- PD.Employees[0].StateTaxes[0].Parameters.Add(1);
- /* Allowances */
- PD.Employees[0].StateTaxes[0].Parameters.Add(0);
- /* Additional allowances */
- PD.Employees[0].StateTaxes[0].Parameters.Add(0);
- /* Additional withholding */
- PD.Employees[0].StateTaxes[0].Parameters.Add(0);
- /* Exempt from State tax: false=0, true=1 */
- PD.Employees[0].StateTaxes[0].Parameters.Add(0);
- // Federal
- PD.Employees[0].FederalTaxes[0] = new EmployeeFederalTax()
- {
- TaxID = 1,
- FilingStatus = (short)FederalTaxCalcs.FilingStatus.Single,
- Allowances = 0,
- SubTaxType = SubTaxType.FederalTax,
- CompanyTaxDueFrequency = Default_FederalTaxDueFrequency,
- SUTAState = StateTested,
- IsW42020OrLater = W42020Tests,
- };
- // FUTA
- // Note the index number. If we left it at 0, it'd just overwrite the previous Federal tax object.
- PD.Employees[0].FederalTaxes.Add(new EmployeeFederalTax()
- {
- TaxID = 3,
- FilingStatus = (short)FederalTaxCalcs.FilingStatus.Single,
- Allowances = 0,
- SubTaxType = SubTaxType.FUTA,
- CompanyTaxDueFrequency = Default_FederalTaxDueFrequency,
- SUTAState = StateTested,
- IsW42020OrLater = W42020Tests,
- });
- var results = Engine.Process(PD);
- Assert.Equal(1000m, results.First().GrossPay, 0);
- Assert.Equal(6m, results.First().PayrollTaxes.Find(x => x.TaxID == 3).CompanyAmount, 0);
- }
- }
- }
Add Comment
Please, Sign In to add comment