コード例 #1
0
        public void GeneratesPayslipWithCorrectData(Employee employee, PayPeriod payPeriod, Payslip expected)
        {
            var taxCalculator           = new TaxCalculator(SetUpTestTaxTable());
            var monthlyPayslipGenerator = new MonthlyPayslipGenerator(taxCalculator);
            var actual = monthlyPayslipGenerator.Generate(employee, payPeriod);

            Assert.Equal(expected.GrossIncome, actual.GrossIncome);
        }
コード例 #2
0
        public void CanCalculateTaxForPayPeriod_RoundsTo5DecimalPlaces(string startDateStr, string endDateStr, decimal annualTax, decimal expected)
        {
            var startDate = DateTime.ParseExact(startDateStr, "d/M/yyyy", CultureInfo.InvariantCulture);
            var endDate   = DateTime.ParseExact(endDateStr, "d/M/yyyy", CultureInfo.InvariantCulture);
            var payPeriod = new PayPeriod(startDate, endDate);
            var actual    = MonthlyPayslipGenerator.CalculateTaxForPayPeriod(annualTax, payPeriod);

            Assert.Equal(expected, actual);
        }