Example #1
0
        public void ReturnSuper(int annualSalary, int superRate, int actualSuper)
        {
            var mockOfEmployee = new Mock <Employee>(It.IsAny <string>(), It.IsAny <string>(), new PaymentDetails(annualSalary, superRate, It.IsAny <string>(), It.IsAny <string>()));
            var paySlip        = new PaySlip.PaySlip(mockOfEmployee.Object, It.IsAny <IEnumerable <TaxRatesInfo> >());
            var expectedSuper  = paySlip.GetSuper();

            Assert.Equal(expectedSuper, actualSuper);
        }
Example #2
0
        public void ReturnGrossIncome(int annualSalary, int actualGrossIncome)
        {
            var mockOfEmployee      = new Mock <Employee>(It.IsAny <string>(), It.IsAny <string>(), new PaymentDetails(annualSalary, It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>()));
            var paySlip             = new PaySlip.PaySlip(mockOfEmployee.Object, It.IsAny <IEnumerable <TaxRatesInfo> >());
            var expectedGrossIncome = paySlip.GetGrossIncome();

            Assert.Equal(expectedGrossIncome, actualGrossIncome);
        }
Example #3
0
        public void ReturnNetIncome(int annualSalary, int actualNetIncome)
        {
            var taxRatesFilePath  = "/Users/kathleen.jumamoy/Projects/Katas/PaySlipV2/PaySlip/files/taxRatesInfo.json";
            var mockOfEmployee    = new Mock <Employee>(It.IsAny <string>(), It.IsAny <string>(), new PaymentDetails(annualSalary, It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>()));
            var taxRates          = new JsonFileReader(taxRatesFilePath).ParseTaxRatesInfoFile();
            var paySlip           = new PaySlip.PaySlip(mockOfEmployee.Object, taxRates);
            var expectedNetIncome = paySlip.GetNetIncome();

            Assert.Equal(expectedNetIncome, actualNetIncome);
        }
Example #4
0
        static void Main(string[] args)
        {
            var fillOutFormFilePath  = "./files/fillOutForm.json";
            var paySlipFilePath      = "./files/paySlip.json";
            var taxRatesInfoFilePath = "./files/taxRatesInfo.json";

            var paySlipConsole = new ConsoleUserInterface();
            var json           = new JsonFileReader(fillOutFormFilePath);
            var formQuestions  = json.ParseBasicFormFile();
            var personDetails  = paySlipConsole.GetPersonDetails(formQuestions);
            var paymentDetails = new PaymentDetails(Convert.ToInt32(personDetails["annualSalary"]), Convert.ToInt32(personDetails["superRate"]), personDetails["paymentStartDate"], personDetails["paymentEndDate"]);
            var employee       = new Employee(personDetails["firstName"], personDetails["lastName"], paymentDetails);

            var taxRates = new JsonFileReader(taxRatesInfoFilePath).ParseTaxRatesInfoFile();
            var paySlip  = new PaySlip(employee, taxRates);
//
            var paySlipForm = new JsonFileReader(paySlipFilePath).ParseBasicFormFile();

//
            paySlipConsole.PrintPaySlip(paySlip, paySlipForm);
        }