public void GivenAnHourlyRate_ShouldYieldGrossPayment() { decimal hourlyRate = 10.00m; decimal hoursWorked = 40.0m; double expectedGrossPay = 400.00; var calculator = new PaymentCalculator(); var grossPay = calculator.calculateGrossPay(hourlyRate, hoursWorked); Assert.AreEqual(expectedGrossPay, grossPay); }
public IncomeReport GenerateReport(string location, decimal hoursWorked, decimal hourlyRate) { var gross = _calc.calculateGrossPay(hourlyRate, hoursWorked); var deductions = new List <LineItem>(); var netPay = gross; foreach (var rule in _deductionRules) { var deductionAmount = rule.Apply(gross); netPay -= deductionAmount; deductions.Add(new LineItem(deductionAmount, rule.Reason)); } return(new IncomeReport(location, gross, deductions, netPay)); }