Ejemplo n.º 1
0
        public void TimeRangePeriodRelationTestDataTest()
        {
            DateTime now      = ClockProxy.Clock.Now;
            TimeSpan duration = Duration.Hour;
            DateTime start    = now;
            DateTime end      = start.Add(duration);
            TimeSpan offset   = Duration.Minute;

            TimeRangePeriodRelationTestData testData = new TimeRangePeriodRelationTestData(start, end, offset);

            Assert.Equal(testData.Reference, new TimeRange(start, end, true));
            Assert.Equal(PeriodRelation.Before, testData.Reference.GetRelation(testData.Before));
            Assert.Equal(PeriodRelation.StartTouching, testData.Reference.GetRelation(testData.StartTouching));
            Assert.Equal(PeriodRelation.StartInside, testData.Reference.GetRelation(testData.StartInside));
            Assert.Equal(PeriodRelation.InsideStartTouching, testData.Reference.GetRelation(testData.InsideStartTouching));
            Assert.Equal(PeriodRelation.EnclosingStartTouching, testData.Reference.GetRelation(testData.EnclosingStartTouching));
            Assert.Equal(PeriodRelation.Inside, testData.Reference.GetRelation(testData.Inside));
            Assert.Equal(PeriodRelation.EnclosingEndTouching, testData.Reference.GetRelation(testData.EnclosingEndTouching));
            Assert.Equal(PeriodRelation.ExactMatch, testData.Reference.GetRelation(testData.ExactMatch));
            Assert.Equal(PeriodRelation.Enclosing, testData.Reference.GetRelation(testData.Enclosing));
            Assert.Equal(PeriodRelation.InsideEndTouching, testData.Reference.GetRelation(testData.InsideEndTouching));
            Assert.Equal(PeriodRelation.EndInside, testData.Reference.GetRelation(testData.EndInside));
            Assert.Equal(PeriodRelation.EndTouching, testData.Reference.GetRelation(testData.EndTouching));
            Assert.Equal(PeriodRelation.After, testData.Reference.GetRelation(testData.After));
        }         // TimeRangePeriodRelationTestDataTest
        public void OverlapsWithTest()
        {
            SchoolDay schoolDay = new SchoolDay();
            TimeSpan  offset    = Duration.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));
        }         // OverlapsWithTest
        public void GetRelationTest()
        {
            SchoolDay schoolDay = new SchoolDay();
            TimeSpan  offset    = Duration.Second;
            TimeRangePeriodRelationTestData 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);
        } // GetRelationTest
        public void GetRelationTest()
        {
            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.AreEqual(timePeriods.GetRelation(testData.Before), PeriodRelation.Before);
            Assert.AreEqual(timePeriods.GetRelation(testData.StartTouching), PeriodRelation.StartTouching);
            Assert.AreEqual(timePeriods.GetRelation(testData.StartInside), PeriodRelation.StartInside);
            Assert.AreEqual(timePeriods.GetRelation(testData.InsideStartTouching), PeriodRelation.InsideStartTouching);
            Assert.AreEqual(timePeriods.GetRelation(testData.EnclosingStartTouching), PeriodRelation.EnclosingStartTouching);
            Assert.AreEqual(timePeriods.GetRelation(testData.Enclosing), PeriodRelation.Enclosing);
            Assert.AreEqual(timePeriods.GetRelation(testData.EnclosingEndTouching), PeriodRelation.EnclosingEndTouching);
            Assert.AreEqual(timePeriods.GetRelation(testData.ExactMatch), PeriodRelation.ExactMatch);
            Assert.AreEqual(timePeriods.GetRelation(testData.Inside), PeriodRelation.Inside);
            Assert.AreEqual(timePeriods.GetRelation(testData.InsideEndTouching), PeriodRelation.InsideEndTouching);
            Assert.AreEqual(timePeriods.GetRelation(testData.EndInside), PeriodRelation.EndInside);
            Assert.AreEqual(timePeriods.GetRelation(testData.EndTouching), PeriodRelation.EndTouching);
            Assert.AreEqual(timePeriods.GetRelation(testData.After), PeriodRelation.After);
        }         // GetRelationTest
        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.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));
        }         // OverlapsWithTest
Ejemplo n.º 6
0
        public void TimeRangePeriodRelationTestDataTest()
        {
            DateTime now = ClockProxy.Clock.Now;
            TimeSpan duration = Duration.Hour;
            DateTime start = now;
            DateTime end = start.Add( duration );
            TimeSpan offset = Duration.Minute;

            TimeRangePeriodRelationTestData testData = new TimeRangePeriodRelationTestData( start, end, offset );
            Assert.AreEqual( testData.Reference, new TimeRange( start, end, true ) );
            Assert.AreEqual( testData.Reference.GetRelation( testData.Before ), PeriodRelation.Before );
            Assert.AreEqual( testData.Reference.GetRelation( testData.StartTouching ), PeriodRelation.StartTouching );
            Assert.AreEqual( testData.Reference.GetRelation( testData.StartInside ), PeriodRelation.StartInside );
            Assert.AreEqual( testData.Reference.GetRelation( testData.InsideStartTouching ), PeriodRelation.InsideStartTouching );
            Assert.AreEqual( testData.Reference.GetRelation( testData.EnclosingStartTouching ), PeriodRelation.EnclosingStartTouching );
            Assert.AreEqual( testData.Reference.GetRelation( testData.Inside ), PeriodRelation.Inside );
            Assert.AreEqual( testData.Reference.GetRelation( testData.EnclosingEndTouching ), PeriodRelation.EnclosingEndTouching );
            Assert.AreEqual( testData.Reference.GetRelation( testData.ExactMatch ), PeriodRelation.ExactMatch );
            Assert.AreEqual( testData.Reference.GetRelation( testData.Enclosing ), PeriodRelation.Enclosing );
            Assert.AreEqual( testData.Reference.GetRelation( testData.InsideEndTouching ), PeriodRelation.InsideEndTouching );
            Assert.AreEqual( testData.Reference.GetRelation( testData.EndInside ), PeriodRelation.EndInside );
            Assert.AreEqual( testData.Reference.GetRelation( testData.EndTouching ), PeriodRelation.EndTouching );
            Assert.AreEqual( testData.Reference.GetRelation( testData.After ), PeriodRelation.After );
        }
        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.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 TimePeriodCollectionTest()
 {
     startTestData = ClockProxy.Clock.Now;
     endTestData = startTestData.Add( durationTesData );
     timeRangeTestData = new TimeRangePeriodRelationTestData( startTestData, endTestData, offsetTestData );
 }
        public void GetRelationTest()
        {
            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.AreEqual( timePeriods.GetRelation( testData.Before ), PeriodRelation.Before );
            Assert.AreEqual( timePeriods.GetRelation( testData.StartTouching ), PeriodRelation.StartTouching );
            Assert.AreEqual( timePeriods.GetRelation( testData.StartInside ), PeriodRelation.StartInside );
            Assert.AreEqual( timePeriods.GetRelation( testData.InsideStartTouching ), PeriodRelation.InsideStartTouching );
            Assert.AreEqual( timePeriods.GetRelation( testData.EnclosingStartTouching ), PeriodRelation.EnclosingStartTouching );
            Assert.AreEqual( timePeriods.GetRelation( testData.Enclosing ), PeriodRelation.Enclosing );
            Assert.AreEqual( timePeriods.GetRelation( testData.EnclosingEndTouching ), PeriodRelation.EnclosingEndTouching );
            Assert.AreEqual( timePeriods.GetRelation( testData.ExactMatch ), PeriodRelation.ExactMatch );
            Assert.AreEqual( timePeriods.GetRelation( testData.Inside ), PeriodRelation.Inside );
            Assert.AreEqual( timePeriods.GetRelation( testData.InsideEndTouching ), PeriodRelation.InsideEndTouching );
            Assert.AreEqual( timePeriods.GetRelation( testData.EndInside ), PeriodRelation.EndInside );
            Assert.AreEqual( timePeriods.GetRelation( testData.EndTouching ), PeriodRelation.EndTouching );
            Assert.AreEqual( timePeriods.GetRelation( testData.After ), PeriodRelation.After );
        }
Ejemplo n.º 10
0
        public void OverlapsWithTest()
        {
            SchoolDay schoolDay = new SchoolDay();
            TimeSpan offset = Duration.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 ) );
        }
Ejemplo n.º 11
0
        public void GetRelationTest()
        {
            SchoolDay schoolDay = new SchoolDay();
            TimeSpan offset = Duration.Second;
            TimeRangePeriodRelationTestData 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 );
        }
Ejemplo n.º 12
0
 // ----------------------------------------------------------------------
 public TimeRangeTest()
 {
     start = ClockProxy.Clock.Now;
     end = start.Add( duration );
     testData = new TimeRangePeriodRelationTestData( start, end, offset );
 }
Ejemplo n.º 13
0
 // ----------------------------------------------------------------------
 public TimeRangeTest()
 {
     start    = ClockProxy.Clock.Now;
     end      = start.Add(duration);
     testData = new TimeRangePeriodRelationTestData(start, end, offset);
 }         // TimeRangeTest
 // ----------------------------------------------------------------------
 public TimePeriodCollectionTest()
 {
     startTestData     = ClockProxy.Clock.Now;
     endTestData       = startTestData.Add(durationTesData);
     timeRangeTestData = new TimeRangePeriodRelationTestData(startTestData, endTestData, offsetTestData);
 }         // TimePeriodCollectionTest