IsSamePeriod() public method

public IsSamePeriod ( ITimePeriod test ) : bool
test ITimePeriod
return bool
        public void IsSamePeriodTest()
        {
            SchoolDay schoolDay = new SchoolDay();
            TimeRange manualRange = new TimeRange( schoolDay.Start, schoolDay.End );

            Assert.IsTrue( schoolDay.IsSamePeriod( schoolDay ) );
            Assert.IsTrue( schoolDay.IsSamePeriod( manualRange ) );
            Assert.IsTrue( manualRange.IsSamePeriod( schoolDay ) );

            Assert.IsFalse( schoolDay.IsSamePeriod( TimeBlock.Anytime ) );
            Assert.IsFalse( manualRange.IsSamePeriod( TimeBlock.Anytime ) );

            schoolDay.RemoveAt( 0 );
            Assert.IsFalse( schoolDay.IsSamePeriod( manualRange ) );
            Assert.IsFalse( manualRange.IsSamePeriod( schoolDay ) );
        }
Esempio n. 2
0
        public void IsSamePeriodTest()
        {
            TimeRange timeRange1 = new TimeRange( start, end );
            TimeRange timeRange2 = new TimeRange( start, end );

            Assert.IsTrue( timeRange1.IsSamePeriod( timeRange1 ) );
            Assert.IsTrue( timeRange2.IsSamePeriod( timeRange2 ) );

            Assert.IsTrue( timeRange1.IsSamePeriod( timeRange2 ) );
            Assert.IsTrue( timeRange2.IsSamePeriod( timeRange1 ) );

            Assert.IsFalse( timeRange1.IsSamePeriod( TimeRange.Anytime ) );
            Assert.IsFalse( timeRange2.IsSamePeriod( TimeRange.Anytime ) );

            timeRange1.Move( new TimeSpan( 1 ) );
            Assert.IsFalse( timeRange1.IsSamePeriod( timeRange2 ) );
            Assert.IsFalse( timeRange2.IsSamePeriod( timeRange1 ) );

            timeRange1.Move( new TimeSpan( -1 ) );
            Assert.IsTrue( timeRange1.IsSamePeriod( timeRange2 ) );
            Assert.IsTrue( timeRange2.IsSamePeriod( timeRange1 ) );
        }