示例#1
0
        public void Create_PaySlip_Generates_Expected_Results_For_An_Employee()
        {
            //Arrange
            var employee = new Employee
            {
                FirstName    = "TestFirstName",
                LastName     = "TestLastName",
                AnnualSalary = 60050,
                SuperRate    = 9,
                PayPeriod    = "01 March - 31 March"
            };

            var roundingService      = new RoundingService();
            var taxCalculatorService = new TaxCalculatorService();
            var payslipService       = new PaySlipService(roundingService, taxCalculatorService);

            //Act
            var result = payslipService.CreatePaySlip(employee);

            //Assert
            Assert.AreEqual(employee.FullName, result.EmployeeName, "Employee Name incorrect");
            Assert.AreEqual(employee.PayPeriod, result.PayPeriod, "Pay Period incorrect");
            Assert.AreEqual(5004, result.GrossIncome, "Gross Income incorrect");
            Assert.AreEqual(922, result.IncomeTax, "Income Tax incorrect");
            Assert.AreEqual(4082, result.NetIncome, "Net Income incorrect");
            Assert.AreEqual(450, result.SuperAmount, "Super incorrect");
        }
        public void Solve(object input)
        {
            var grades = input.ToIntList(' ');
            var output = new List <int>();

            grades.ForEach(grade => output.Add(RoundingService.Round(grade, 5, 2, 38)));

            output.ForEach(grade => Console.WriteLine(grade));
        }
        public void When_ApplyRounding_Called_With_EqualOrMore_Than_50_Cents_Then_Round_Up_Is_Applied(decimal moneyToRound, decimal roundedResult)
        {
            //Arrange
            var roundingService = new RoundingService();

            //Apply
            var result = roundingService.ApplyRounding(moneyToRound);

            //Assert
            Assert.AreEqual(roundedResult, result);
        }