public void TestTimePeriodManager_Intersection() { TimePeriodPacket ti1 = new TimePeriodPacket(beginTime, beginTime.AddDays(1)); TimePeriodPacket ti2 = new TimePeriodPacket(beginTime.AddHours(1), beginTime.AddHours(2)); TimePeriodPacket ti3 = new TimePeriodPacket(beginTime.AddHours(1), beginTime.AddDays(2)); TimePeriodPacket ti1_3 = new TimePeriodPacket(beginTime.AddHours(1), beginTime.AddDays(1)); TimePeriodPacket invalid = new TimePeriodPacket(beginTime.AddDays(1), beginTime); assertEqual(ti2, TimePeriodManager.Intersection(ti1, ti2)); assertEqual(ti2, TimePeriodManager.Intersection(ti2, ti1)); assertEqual(ti1_3, TimePeriodManager.Intersection(ti3, ti1)); assertEqual(ti1_3, TimePeriodManager.Intersection(ti1, ti3)); Assert.IsNull(TimePeriodManager.Intersection(ti1, invalid)); Assert.IsNull(TimePeriodManager.Intersection(invalid, ti1)); }
public bool IsValidTime(TimePeriodPacket timePeriod) { return(_missingTi.Any(_ => TimePeriodManager.Intersection(_, timePeriod) != null)); }