public void ShrinkToTest() { TimeRange timeRange = new TimeRange( start, end ); // no shrink timeRange.ShrinkTo( new TimeRange( start.AddMilliseconds( -1 ), end.AddMilliseconds( 1 ) ) ); Assert.AreEqual( timeRange.Start, start ); Assert.AreEqual( timeRange.End, end ); // start DateTime changedStart = start.AddMinutes( 1 ); timeRange.ShrinkTo( new TimeRange( changedStart, end ) ); Assert.AreEqual( timeRange.Start, changedStart ); Assert.AreEqual( timeRange.End, end ); // end DateTime changedEnd = end.AddMinutes( -1 ); timeRange.ShrinkTo( new TimeRange( changedStart, changedEnd ) ); Assert.AreEqual( timeRange.Start, changedStart ); Assert.AreEqual( timeRange.End, changedEnd ); // start/end changedStart = changedStart.AddMinutes( 1 ); changedEnd = changedEnd.AddMinutes( -1 ); timeRange.ShrinkTo( new TimeRange( changedStart, changedEnd ) ); Assert.AreEqual( timeRange.Start, changedStart ); Assert.AreEqual( timeRange.End, changedEnd ); }