示例#1
0
        public static bool ContainsDate(this IDateInterval interval, DateTime?date)
        {
            if (date == null)
            {
                return(false);
            }

            var startDate = interval.StartDate;
            var endDate   = interval.EndDate;

            return((startDate == null || date >= startDate) && (endDate == null || date <= endDate));
        }
        public void ContainsDateShouldReturnTrueWhenIntervalIsInfinite(IDateInterval interval, DateTime date)
        {
            var result = interval.ContainsDate(date);

            Assert.True(result);
        }
        public void ContainsDateShouldReturnFalseWhenNullIsProvided(IDateInterval interval)
        {
            var result = interval.ContainsDate(null);

            Assert.False(result);
        }