ekioISpro

Untitled

May 7th, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.21 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using WNPayroll.TaxCalcs;
  4. using WNPayroll.Zenith.Models.Data.Payroll;
  5. using Xunit;
  6. using Zenith.Business.Engine;
  7. using Zenith.Models.Data.Payroll.PayData;
  8. using SubTaxType = WNPayroll.Zenith.Models.Data.Enums.SubTaxType;
  9.  
  10. namespace Zenith.UnitTests.Test_Cases
  11. {
  12.     public class StatutoryTaxingTests
  13.     {
  14.         private readonly PayrollEngineV2 Engine = new PayrollEngineV2();
  15.         private ZenithPayrollData PD = new ZenithPayrollData();
  16.  
  17.         private readonly Boolean W42020Tests = false;
  18.         private readonly States StateTested = States.CA;
  19.  
  20.         /*  Monthly = 1
  21.          *  Semi-weekly = 2   */
  22.         private readonly short Default_FederalTaxDueFrequency = 1;
  23.  
  24.         [Fact]
  25.         public void P51()
  26.         {
  27.             PD = TestDefaults.ResetPayrollData(StateTested);
  28.  
  29.             PD.Employees[0].PayDataRecords[0] = TestDefaults.DefaultRecord(25, 40);
  30.  
  31.             PD.Employees[0].FederalTaxes[0] = new EmployeeFederalTax()
  32.             {
  33.                 TaxID = 1,
  34.                 FilingStatus = (short)FederalTaxCalcs.FilingStatus.Single,
  35.                 Allowances = 0,
  36.                 AdditionalWithholding = 0,
  37.                 SubTaxType = SubTaxType.FederalTax,
  38.  
  39.                 CompanyTaxDueFrequency = Default_FederalTaxDueFrequency,
  40.                 SUTAState = StateTested,
  41.                 IsW42020OrLater = W42020Tests,
  42.             };
  43.  
  44.             PD.Employees[0].FederalTaxes.Add(new EmployeeFederalTax()
  45.             {
  46.                 TaxID = 2,
  47.                 SubTaxType = SubTaxType.SocialSecurity,
  48.                 Exempt=true,
  49.  
  50.                 SUTAState = StateTested,
  51.                 CompanyTaxDueFrequency = Default_FederalTaxDueFrequency,
  52.             });
  53.  
  54.             var results = Engine.Process(PD);
  55.  
  56.             Assert.Equal(1000m, results.First().GrossPay, 0);
  57.             Assert.Equal(62m, results.First().PayrollTaxes.Find(x => x.TaxID == 2).CompanyAmount, 0);
  58.         }
  59.         [Fact]
  60.         public void P52()
  61.         {
  62.             PD = TestDefaults.ResetPayrollData(StateTested);
  63.  
  64.             PD.Employees[0].PayDataRecords[0] = TestDefaults.DefaultRecord(25, 40);
  65.  
  66.             PD.Employees[0].FederalTaxes[0] = new EmployeeFederalTax()
  67.             {
  68.                 TaxID = 1,
  69.                 FilingStatus = (short)FederalTaxCalcs.FilingStatus.Single,
  70.                 Allowances = 0,
  71.                 AdditionalWithholding = 0,
  72.                 SubTaxType = SubTaxType.FederalTax,
  73.  
  74.                 CompanyTaxDueFrequency = Default_FederalTaxDueFrequency,
  75.                 SUTAState = StateTested,
  76.                 IsW42020OrLater = W42020Tests,
  77.             };
  78.  
  79.             PD.Employees[0].FederalTaxes.Add(new EmployeeFederalTax()
  80.             {
  81.                 TaxID = 2,
  82.                 SubTaxType = SubTaxType.Medicare,
  83.                 Exempt = true,
  84.  
  85.                 SUTAState = StateTested,
  86.                 CompanyTaxDueFrequency = Default_FederalTaxDueFrequency,
  87.             });
  88.  
  89.             var results = Engine.Process(PD);
  90.  
  91.             Assert.Equal(1000m, results.First().GrossPay, 0);
  92.             Assert.Equal(14.5m, results.First().PayrollTaxes.Find(x => x.TaxID == 2).CompanyAmount, 0);
  93.         }
  94.     }
  95. }
Add Comment
Please, Sign In to add comment