public void OverlapsWithTest() {
            var now = ClockProxy.Clock.Now;
            var offset = DurationUtil.Second;
            var testData = new TimeRangePeriodRelationTestData(now, now.AddHours(1), offset);
            var timePeriods = new TimePeriodCollection
                              {
                                  testData.Reference
                              };

            Assert.IsFalse(timePeriods.OverlapsWith(testData.Before));
            Assert.IsFalse(timePeriods.OverlapsWith(testData.StartTouching));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.StartInside));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.InsideStartTouching));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.EnclosingStartTouching));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.Enclosing));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.EnclosingEndTouching));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.ExactMatch));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.Inside));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.InsideEndTouching));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.EndInside));
            Assert.IsFalse(timePeriods.OverlapsWith(testData.EndTouching));
            Assert.IsFalse(timePeriods.OverlapsWith(testData.After));
        }
Example #2
0
        public void OverlapsWithTest()
        {
            DateTime now    = ClockProxy.Clock.Now;
            TimeSpan offset = Duration.Second;
            TimeRangePeriodRelationTestData testData    = new TimeRangePeriodRelationTestData(now, now.AddHours(1), offset);
            TimePeriodCollection            timePeriods = new TimePeriodCollection();

            timePeriods.Add(testData.Reference);

            Assert.False(timePeriods.OverlapsWith(testData.Before));
            Assert.False(timePeriods.OverlapsWith(testData.StartTouching));
            Assert.True(timePeriods.OverlapsWith(testData.StartInside));
            Assert.True(timePeriods.OverlapsWith(testData.InsideStartTouching));
            Assert.True(timePeriods.OverlapsWith(testData.EnclosingStartTouching));
            Assert.True(timePeriods.OverlapsWith(testData.Enclosing));
            Assert.True(timePeriods.OverlapsWith(testData.EnclosingEndTouching));
            Assert.True(timePeriods.OverlapsWith(testData.ExactMatch));
            Assert.True(timePeriods.OverlapsWith(testData.Inside));
            Assert.True(timePeriods.OverlapsWith(testData.InsideEndTouching));
            Assert.True(timePeriods.OverlapsWith(testData.EndInside));
            Assert.False(timePeriods.OverlapsWith(testData.EndTouching));
            Assert.False(timePeriods.OverlapsWith(testData.After));
        }         // OverlapsWithTest
Example #3
0
        public void OverlapsWithTest()
        {
            var now         = ClockProxy.Clock.Now;
            var offset      = DurationUtil.Second;
            var testData    = new TimeRangePeriodRelationTestData(now, now.AddHours(1), offset);
            var timePeriods = new TimePeriodCollection
            {
                testData.Reference
            };

            Assert.IsFalse(timePeriods.OverlapsWith(testData.Before));
            Assert.IsFalse(timePeriods.OverlapsWith(testData.StartTouching));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.StartInside));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.InsideStartTouching));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.EnclosingStartTouching));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.Enclosing));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.EnclosingEndTouching));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.ExactMatch));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.Inside));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.InsideEndTouching));
            Assert.IsTrue(timePeriods.OverlapsWith(testData.EndInside));
            Assert.IsFalse(timePeriods.OverlapsWith(testData.EndTouching));
            Assert.IsFalse(timePeriods.OverlapsWith(testData.After));
        }