I need to create a test to verify my
NewBusinessDateTime.calculate(Integer hoursToAdd) works. The sudo code of what
calculate() does is:
IF currentDateTime.addHours(hoursToAdd) IS WITHIN BUSINESS HOURS RETURN currentDateTime.addHours(hoursToAdd) ELSE RETURN nextDateTimeBusinessIsOpenRightWhenBusinessOpens
The business hours are
// M-F 8 AM - 8 PM // SAT 10 AM - 4 PM // SUN Closed
What would be the most effective way to write a test to cover every possible time, 24 hours a day, 7 days week? Or is that desire too excessive? Unfortunately in my production code, I'm getting reports from users saying what
NewBusinessDateTime.calculate(Integer hoursToAdd) is outputting is sometimes in the past, too far into the future, and other unexpected behavior.