public void CalculateOvertimePayWhenOvertimeIsPresentTest() { const int hoursWorkedWithOverTime = 41; const int hourlyRate = 10; const decimal expectedOvertimePay = 15; const decimal overtimeFactor = 1.5m; PayCalculator payCalculator = new PayCalculator(); decimal actualOvertimePay = payCalculator.CalculateOvertimePay(hoursWorkedWithOverTime, hourlyRate, overtimeFactor); Assert.IsTrue(expectedOvertimePay == actualOvertimePay, $"Expected overtime pay {expectedOvertimePay} to equal actual overtime pay {actualOvertimePay}"); }
public void CalculateOvertimePayWhenOvertimeIsNotPresentTest() { const int hoursWorkedExactlyRegularPayInterval = 40; const int hoursWorkedLessThanRegularPayInterval = 39; const int hourlyRate = 10; const decimal expectedOvertimePay = 0; const decimal overtimeFactor = 1.5m; PayCalculator payCalculator = new PayCalculator(); decimal actualOvertimePayWhenHoursWorkedIsExactlyRegularPayInteveral = payCalculator.CalculateOvertimePay(hoursWorkedExactlyRegularPayInterval, hourlyRate, overtimeFactor); Assert.IsTrue(expectedOvertimePay == actualOvertimePayWhenHoursWorkedIsExactlyRegularPayInteveral, $"Expected overtime pay {expectedOvertimePay} when hours worked {hoursWorkedExactlyRegularPayInterval} is equal to the regular pay interval to equal actual overtime pay {actualOvertimePayWhenHoursWorkedIsExactlyRegularPayInteveral}"); decimal actualOvertimePayWhenHoursWorkedIsLessThanRegularPayInteveral = payCalculator.CalculateOvertimePay(hoursWorkedLessThanRegularPayInterval, hourlyRate, overtimeFactor); Assert.IsTrue(expectedOvertimePay == actualOvertimePayWhenHoursWorkedIsLessThanRegularPayInteveral, $"Expected overtime pay {expectedOvertimePay} when hours worked {hoursWorkedLessThanRegularPayInterval} is equal to the regular pay interval to equal actual overtime pay {actualOvertimePayWhenHoursWorkedIsLessThanRegularPayInteveral}"); }