示例#1
0
        public void IsTollFreeDate_PublicHoliday_ReturnsTrue()
        {
            IHolidayLookup holidayLookup = Substitute.For <IHolidayLookup>();
            var            date          = new DateTime(2017, 11, 27);

            holidayLookup.IsPublicHoliday(date).Returns(true);
            var tollFeeCalculator = new TollFeeCalculator(holidayLookup);

            tollFeeCalculator.IsTollFreeDate(date).ShouldBeTrue();
        }
 /// <summary>
 /// Returns true if a passage on a certain date is not subject for a toll fee.
 /// </summary>
 internal bool IsTollFreeDate(DateTime date)
 {
     return(date.DayOfWeek == DayOfWeek.Saturday ||
            date.DayOfWeek == DayOfWeek.Sunday ||
            holidayLookup.IsPublicHoliday(date));
 }