public void FamilyARateValidation() { var familyARates = new FamilyARateRangeList(); //Make sure all the rate ranges match the spec Assert.IsTrue(familyARates.FamilyRateRanges.All(a => (a.RateInDollars == 15 && a.TimeRangeForRate.StartingTime24H == 17 && a.TimeRangeForRate.EndingTime24H == 23) || (a.RateInDollars == 20 && a.TimeRangeForRate.StartingTime24H == 23 && a.TimeRangeForRate.EndingTime24H == 4))); }
public void FamilyANightRateTests() { var familyRateRange = new FamilyARateRangeList(); //Test Full night with family A | 15$ per hour for 6 hours between 5pm and 11pm = 90, 20$ hour for 5 hours between 11pm and 4am = 100 var nightlyPay = NightlyTotalPayCalculator.CalculateAmountOwedForGivenNightlySchedule(new ScheduledInterval(), familyRateRange); Assert.IsTrue(nightlyPay == 190); //Test night with family A overlapping both pay rate schedules | 15$ per hour for 1 hour between 10pm and 11pm, //20$ hour for 2 hours between 11pm and 1am = 55 nightlyPay = NightlyTotalPayCalculator.CalculateAmountOwedForGivenNightlySchedule(new ScheduledInterval() { EndingTime24H = 1, StartingTime24H = 22 }, familyRateRange); Assert.IsTrue(nightlyPay == 55); //Test night with family A all hours in first pay rate window | 15$ per hour for 3 hour between 6pm and 9pm = 45 nightlyPay = NightlyTotalPayCalculator.CalculateAmountOwedForGivenNightlySchedule(new ScheduledInterval() { EndingTime24H = 21, StartingTime24H = 18 }, familyRateRange); Assert.IsTrue(nightlyPay == 45); //Test night with family A all hours in second pay rate window | 20$ per hour for 4 hours between 12pm and 4am = 80 nightlyPay = NightlyTotalPayCalculator.CalculateAmountOwedForGivenNightlySchedule(new ScheduledInterval() { EndingTime24H = 4, StartingTime24H = 24 }, familyRateRange); Assert.IsTrue(nightlyPay == 80); }