Exemplo n.º 1
0
        public void ClassSetUp()
        {
            _start = DateTime.Now;
            _end   = _start.Add(duration);

            _testData = new TimeRangePeriodRelationTestData(_start, _end, offset);
        }
Exemplo n.º 2
0
        public void GetRelationTest()
        {
            var schoolDay = new SchoolDay();
            var offset    = DurationUtil.Second;
            var testData  = new TimeRangePeriodRelationTestData(schoolDay.Start, schoolDay.End, offset);

            Assert.AreEqual(schoolDay.GetRelation(testData.Before), PeriodRelation.Before);
            Assert.AreEqual(schoolDay.GetRelation(testData.StartTouching), PeriodRelation.StartTouching);
            Assert.AreEqual(schoolDay.GetRelation(testData.StartInside), PeriodRelation.StartInside);
            Assert.AreEqual(schoolDay.GetRelation(testData.InsideStartTouching), PeriodRelation.InsideStartTouching);
            Assert.AreEqual(schoolDay.GetRelation(testData.EnclosingStartTouching), PeriodRelation.EnclosingStartTouching);
            Assert.AreEqual(schoolDay.GetRelation(testData.Enclosing), PeriodRelation.Enclosing);
            Assert.AreEqual(schoolDay.GetRelation(testData.EnclosingEndTouching), PeriodRelation.EnclosingEndTouching);
            Assert.AreEqual(schoolDay.GetRelation(testData.ExactMatch), PeriodRelation.ExactMatch);
            Assert.AreEqual(schoolDay.GetRelation(testData.Inside), PeriodRelation.Inside);
            Assert.AreEqual(schoolDay.GetRelation(testData.InsideEndTouching), PeriodRelation.InsideEndTouching);
            Assert.AreEqual(schoolDay.GetRelation(testData.EndInside), PeriodRelation.EndInside);
            Assert.AreEqual(schoolDay.GetRelation(testData.EndTouching), PeriodRelation.EndTouching);
            Assert.AreEqual(schoolDay.GetRelation(testData.After), PeriodRelation.After);
        }
Exemplo n.º 3
0
        public void OverlapsWithTest()
        {
            SchoolDay schoolDay = new SchoolDay();
            TimeSpan  offset    = DurationUtil.Second;
            TimeRangePeriodRelationTestData testData = new TimeRangePeriodRelationTestData(schoolDay.Start, schoolDay.End, offset);

            Assert.IsFalse(schoolDay.OverlapsWith(testData.Before));
            Assert.IsFalse(schoolDay.OverlapsWith(testData.StartTouching));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.StartInside));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.InsideStartTouching));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.EnclosingStartTouching));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.Enclosing));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.EnclosingEndTouching));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.ExactMatch));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.Inside));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.InsideEndTouching));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.EndInside));
            Assert.IsFalse(schoolDay.OverlapsWith(testData.EndTouching));
            Assert.IsFalse(schoolDay.OverlapsWith(testData.After));
        }
Exemplo n.º 4
0
        public void GetRelationTest()
        {
            var now         = ClockProxy.Clock.Now;
            var offset      = DurationUtil.Second;
            var testData    = new TimeRangePeriodRelationTestData(now, now.AddHours(1), offset);
            var timePeriods = new TimePeriodCollection
            {
                testData.Reference
            };

            timePeriods.GetRelation(testData.Before).Should().Be(PeriodRelation.Before);
            timePeriods.GetRelation(testData.StartTouching).Should().Be(PeriodRelation.StartTouching);
            timePeriods.GetRelation(testData.StartInside).Should().Be(PeriodRelation.StartInside);
            timePeriods.GetRelation(testData.InsideStartTouching).Should().Be(PeriodRelation.InsideStartTouching);
            timePeriods.GetRelation(testData.EnclosingStartTouching).Should().Be(PeriodRelation.EnclosingStartTouching);
            timePeriods.GetRelation(testData.Enclosing).Should().Be(PeriodRelation.Enclosing);
            timePeriods.GetRelation(testData.EnclosingEndTouching).Should().Be(PeriodRelation.EnclosingEndTouching);
            timePeriods.GetRelation(testData.ExactMatch).Should().Be(PeriodRelation.ExactMatch);
            timePeriods.GetRelation(testData.Inside).Should().Be(PeriodRelation.Inside);
            timePeriods.GetRelation(testData.InsideEndTouching).Should().Be(PeriodRelation.InsideEndTouching);
            timePeriods.GetRelation(testData.EndInside).Should().Be(PeriodRelation.EndInside);
            timePeriods.GetRelation(testData.EndTouching).Should().Be(PeriodRelation.EndTouching);
            timePeriods.GetRelation(testData.After).Should().Be(PeriodRelation.After);
        }
Exemplo n.º 5
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));
        }
        public void GetRelationTest() {
            var now = ClockProxy.Clock.Now;
            var offset = DurationUtil.Second;
            var testData = new TimeRangePeriodRelationTestData(now, now.AddHours(1), offset);
            var timePeriods = new TimePeriodCollection
                              {
                                  testData.Reference
                              };

            timePeriods.GetRelation(testData.Before).Should().Be(PeriodRelation.Before);
            timePeriods.GetRelation(testData.StartTouching).Should().Be(PeriodRelation.StartTouching);
            timePeriods.GetRelation(testData.StartInside).Should().Be(PeriodRelation.StartInside);
            timePeriods.GetRelation(testData.InsideStartTouching).Should().Be(PeriodRelation.InsideStartTouching);
            timePeriods.GetRelation(testData.EnclosingStartTouching).Should().Be(PeriodRelation.EnclosingStartTouching);
            timePeriods.GetRelation(testData.Enclosing).Should().Be(PeriodRelation.Enclosing);
            timePeriods.GetRelation(testData.EnclosingEndTouching).Should().Be(PeriodRelation.EnclosingEndTouching);
            timePeriods.GetRelation(testData.ExactMatch).Should().Be(PeriodRelation.ExactMatch);
            timePeriods.GetRelation(testData.Inside).Should().Be(PeriodRelation.Inside);
            timePeriods.GetRelation(testData.InsideEndTouching).Should().Be(PeriodRelation.InsideEndTouching);
            timePeriods.GetRelation(testData.EndInside).Should().Be(PeriodRelation.EndInside);
            timePeriods.GetRelation(testData.EndTouching).Should().Be(PeriodRelation.EndTouching);
            timePeriods.GetRelation(testData.After).Should().Be(PeriodRelation.After);
        }
        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));
        }
 public TimePeriodCollectionFixture() {
     _startTestTime = ClockProxy.Clock.Now;
     _endTestTime = _startTestTime.Add(_durationHour);
     _timeRangeTestData = new TimeRangePeriodRelationTestData(_startTestTime, _endTestTime, _offsetTestDuration);
 }
Exemplo n.º 9
0
        public void GetRelationTest() {
            var schoolDay = new SchoolDay();
            var offset = DurationUtil.Second;
            var testData = new TimeRangePeriodRelationTestData(schoolDay.Start, schoolDay.End, offset);

            Assert.AreEqual(schoolDay.GetRelation(testData.Before), PeriodRelation.Before);
            Assert.AreEqual(schoolDay.GetRelation(testData.StartTouching), PeriodRelation.StartTouching);
            Assert.AreEqual(schoolDay.GetRelation(testData.StartInside), PeriodRelation.StartInside);
            Assert.AreEqual(schoolDay.GetRelation(testData.InsideStartTouching), PeriodRelation.InsideStartTouching);
            Assert.AreEqual(schoolDay.GetRelation(testData.EnclosingStartTouching), PeriodRelation.EnclosingStartTouching);
            Assert.AreEqual(schoolDay.GetRelation(testData.Enclosing), PeriodRelation.Enclosing);
            Assert.AreEqual(schoolDay.GetRelation(testData.EnclosingEndTouching), PeriodRelation.EnclosingEndTouching);
            Assert.AreEqual(schoolDay.GetRelation(testData.ExactMatch), PeriodRelation.ExactMatch);
            Assert.AreEqual(schoolDay.GetRelation(testData.Inside), PeriodRelation.Inside);
            Assert.AreEqual(schoolDay.GetRelation(testData.InsideEndTouching), PeriodRelation.InsideEndTouching);
            Assert.AreEqual(schoolDay.GetRelation(testData.EndInside), PeriodRelation.EndInside);
            Assert.AreEqual(schoolDay.GetRelation(testData.EndTouching), PeriodRelation.EndTouching);
            Assert.AreEqual(schoolDay.GetRelation(testData.After), PeriodRelation.After);
        }
Exemplo n.º 10
0
        public void OverlapsWithTest() {
            SchoolDay schoolDay = new SchoolDay();
            TimeSpan offset = DurationUtil.Second;
            TimeRangePeriodRelationTestData testData = new TimeRangePeriodRelationTestData(schoolDay.Start, schoolDay.End, offset);

            Assert.IsFalse(schoolDay.OverlapsWith(testData.Before));
            Assert.IsFalse(schoolDay.OverlapsWith(testData.StartTouching));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.StartInside));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.InsideStartTouching));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.EnclosingStartTouching));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.Enclosing));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.EnclosingEndTouching));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.ExactMatch));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.Inside));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.InsideEndTouching));
            Assert.IsTrue(schoolDay.OverlapsWith(testData.EndInside));
            Assert.IsFalse(schoolDay.OverlapsWith(testData.EndTouching));
            Assert.IsFalse(schoolDay.OverlapsWith(testData.After));
        }
Exemplo n.º 11
0
 public TimePeriodCollectionFixture()
 {
     _startTestTime     = ClockProxy.Clock.Now;
     _endTestTime       = _startTestTime.Add(_durationHour);
     _timeRangeTestData = new TimeRangePeriodRelationTestData(_startTestTime, _endTestTime, _offsetTestDuration);
 }
Exemplo n.º 12
0
        public void ClassSetUp() {
            _start = DateTime.Now;
            _end = _start.Add(duration);

            _testData = new TimeRangePeriodRelationTestData(_start, _end, offset);
        }