public void FamilyCRateValidation() { var familyCRates = new FamilyCRateRangeList(); //Make sure all the rate ranges match the spec Assert.IsTrue(familyCRates.FamilyRateRanges.All(a => (a.RateInDollars == 21 && a.TimeRangeForRate.StartingTime24H == 17 && a.TimeRangeForRate.EndingTime24H == 21) || (a.RateInDollars == 15 && a.TimeRangeForRate.StartingTime24H == 21 && a.TimeRangeForRate.EndingTime24H == 4))); }
public void FamilyCNightRateTests() { var familyRateRange = new FamilyCRateRangeList(); //Test Full night with family C | 21$ per hour for 4 hours between 5pm and 9pm, 15$ hour for 7 hours between 9pm and 4am = 195 var nightlyPay = NightlyTotalPayCalculator.CalculateAmountOwedForGivenNightlySchedule(new ScheduledInterval(), familyRateRange); Assert.IsTrue(nightlyPay == 189); //Test night with family C overlapping both pay rate schedules | 21$ per hour for 2 hours between 7pm and 9pm, //15$ hour for 3 hours between 9pm and 12am = 87 nightlyPay = NightlyTotalPayCalculator.CalculateAmountOwedForGivenNightlySchedule(new ScheduledInterval() { EndingTime24H = 24, StartingTime24H = 19 }, familyRateRange); Assert.IsTrue(nightlyPay == 87); //Test night with family C all hours in first pay rate window | 21$ per hour for 4 hours between 5pm and 9pm = 84 nightlyPay = NightlyTotalPayCalculator.CalculateAmountOwedForGivenNightlySchedule(new ScheduledInterval() { EndingTime24H = 21 }, familyRateRange); Assert.IsTrue(nightlyPay == 84); //Test night with family C all hours in second pay rate window | 15$ per hour for 5 hours between 11pm and 4am = 75 nightlyPay = NightlyTotalPayCalculator.CalculateAmountOwedForGivenNightlySchedule(new ScheduledInterval() { EndingTime24H = 4, StartingTime24H = 23 }, familyRateRange); Assert.IsTrue(nightlyPay == 75); }