Ejemplo n.º 1
0
        public static string GetPayslip(string input)
        {
            var inputProcessor   = new InputProcessor();
            var payslipGenerator = new PayslipCalculator();
            var outputProcessor  = new OutputProcessor();

            //InputProcessor will split the required Input from string
            payslipInput = inputProcessor.Process(input);

            //Payslip Generator internally will calculate tax and create tax table to prepare payslip
            payslipInfo = payslipGenerator.Calculate(payslipInput);

            //OutputProcessor will join the output in string
            return(outputProcessor.Process(payslipInfo));
        }
Ejemplo n.º 2
0
        public void PayslipCalculatorTest()
        {
            string Input    = "David,Rudd,60050,9%,01 March – 31 March";
            string Expected = "David Rudd,01 March – 31 March,5004,922,4082,450";
            string Actual;

            PayslipInput payslipInput;
            PayslipInfo  payslipInfo;

            var inputProcessor    = new InputProcessor();
            var payslipCalculator = new PayslipCalculator();
            var outputProcessor   = new OutputProcessor();

            payslipInput = inputProcessor.Process(Input);
            payslipInfo  = payslipCalculator.Calculate(payslipInput);
            Actual       = outputProcessor.Process(payslipInfo);
            Assert.AreEqual(Expected, Actual);
        }