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

IntersectsWith() public method

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

Usage Example

コード例 #1
0
        public void IntersectsWithTest()
        {
            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.IntersectsWith( testData.Before ) );
            Assert.IsTrue( timePeriods.IntersectsWith( testData.StartTouching ) );
            Assert.IsTrue( timePeriods.IntersectsWith( testData.StartInside ) );
            Assert.IsTrue( timePeriods.IntersectsWith( testData.InsideStartTouching ) );
            Assert.IsTrue( timePeriods.IntersectsWith( testData.EnclosingStartTouching ) );
            Assert.IsTrue( timePeriods.IntersectsWith( testData.Enclosing ) );
            Assert.IsTrue( timePeriods.IntersectsWith( testData.EnclosingEndTouching ) );
            Assert.IsTrue( timePeriods.IntersectsWith( testData.ExactMatch ) );
            Assert.IsTrue( timePeriods.IntersectsWith( testData.Inside ) );
            Assert.IsTrue( timePeriods.IntersectsWith( testData.InsideEndTouching ) );
            Assert.IsTrue( timePeriods.IntersectsWith( testData.EndInside ) );
            Assert.IsTrue( timePeriods.IntersectsWith( testData.EndTouching ) );
            Assert.IsFalse( timePeriods.IntersectsWith( testData.After ) );
        }