Example #1
0
        public void TestNationalInsuranceEngineResolution()
        {
            Assert.AreEqual(typeof(NationalInsurance2014), DefaultEngineResolver.GetEngine <INiCalculationEngine>(2014).GetType());
            Assert.AreEqual(typeof(NationalInsurance2015), DefaultEngineResolver.GetEngine <INiCalculationEngine>(2015).GetType());
            Assert.AreEqual(typeof(NationalInsurance2016), DefaultEngineResolver.GetEngine <INiCalculationEngine>(2016).GetType());
            Assert.AreEqual(typeof(NationalInsurance2017), DefaultEngineResolver.GetEngine <INiCalculationEngine>(2017).GetType());

            // TODO: Update to latest as this goes on
            Assert.AreEqual(typeof(NationalInsurance2017), DefaultEngineResolver.GetEngine <INiCalculationEngine>(2020).GetType());
        }
Example #2
0
        public void TestPayeEngineResolution()
        {
            Assert.AreEqual(typeof(PayeVersion12), DefaultEngineResolver.GetEngine <IPayeCalculationEngine>(2014).GetType());
            Assert.AreEqual(typeof(PayeVersion13), DefaultEngineResolver.GetEngine <IPayeCalculationEngine>(2015).GetType());
            Assert.AreEqual(typeof(PayeVersion13), DefaultEngineResolver.GetEngine <IPayeCalculationEngine>(2016).GetType());
            Assert.AreEqual(typeof(PayeVersion13), DefaultEngineResolver.GetEngine <IPayeCalculationEngine>(2017).GetType());

            // TODO: Update to latest as this goes on
            Assert.AreEqual(typeof(PayeVersion13), DefaultEngineResolver.GetEngine <IPayeCalculationEngine>(2020).GetType());
        }
Example #3
0
        protected decimal LegacyShim(decimal gross, string taxCode, PayPeriods periods, int period, decimal gtd, decimal ttd, bool wk1, int year)
        {
            if (!CalcEngines.ContainsKey(year))
            {
                CalcEngines.Add(year, DefaultEngineResolver.GetEngine <IPayeCalculationEngine>(year));
                CalcEngines[year].SetTaxYearSpecificsProvider(new JsonTaxYearSpecificProvider());
                CalcEngines[year].SetTaxYear(year);
            }

            return(CalcEngines[year].CalculateTaxDueForPeriod(taxCode, gross, periods, period, wk1, gtd, ttd));
        }
Example #4
0
        protected NationalInsuranceCalculation GetCalculationResult(decimal gross, char niCode, PayPeriods periods, int year)
        {
            if (!CalcEngines.ContainsKey(year))
            {
                CalcEngines.Add(year, DefaultEngineResolver.GetEngine <INiCalculationEngine>(year));
                CalcEngines[year].SetTaxYearSpecificsProvider(new JsonTaxYearSpecificProvider());
                CalcEngines[year].SetTaxYear(year);
            }

            return(CalcEngines[year].CalculateNationalInsurance(gross, niCode, periods));
        }
Example #5
0
        protected decimal TestShim(decimal gross, char niCode, PayPeriods periods, int year)
        {
            if (!CalcEngines.ContainsKey(year))
            {
                CalcEngines.Add(year, DefaultEngineResolver.GetEngine <INiCalculationEngine>(year));
                CalcEngines[year].SetTaxYearSpecificsProvider(new JsonTaxYearSpecificProvider());
                CalcEngines[year].SetTaxYear(year);
            }

            var result = CalcEngines[year].CalculateNationalInsurance(gross, niCode, periods);

            return(result.EmployeeNi + result.EmployerNi);
        }