Itenso.TimePeriod.TimePeriodCollection.OverlapsWith C# (CSharp) Method

OverlapsWith() public method

public OverlapsWith ( ITimePeriod test ) : bool
test ITimePeriod
return bool
        public virtual bool OverlapsWith( ITimePeriod test )
        {
            if ( test == null )
            {
                throw new ArgumentNullException( "test" );
            }
            return TimePeriodCalc.OverlapsWith( this, test );
        }

Usage Example

コード例 #1
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.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 ) );
        }