Пример #1
0
        public void GeneratePayslip(Employee employee)
        {
            // should these be methods so I can test them individually?
            Name = employee.Name + " " + employee.Surname;

            PayPeriod = employee.PaymentStartDate.ToString("dd MMMM") + " - " + employee.PaymentEndDate.ToString("dd MMMM");;

            GrossIncome = (int)Math.Round(employee.Salary / 12M, MidpointRounding.ToEven);

            TaxCalculator taxCalculator = new TaxCalculator();

            IncomeTax = taxCalculator.CalculateTax(employee.Salary);

            NetIncome = GrossIncome - IncomeTax;
            Super     = (int)Math.Round(GrossIncome * (employee.SuperRate / 100M), MidpointRounding.ToEven);
        }
Пример #2
0
        public void CalculateTax_Test()
        {
            TaxCalculator test = new TaxCalculator();

            Assert.AreEqual(test.CalculateTax(60050), 922);
        }