本文整理汇总了C#中Itenso.TimePeriod.TimeRange.Move方法的典型用法代码示例。如果您正苦于以下问题:C# TimeRange.Move方法的具体用法?C# TimeRange.Move怎么用?C# TimeRange.Move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Itenso.TimePeriod.TimeRange
的用法示例。
在下文中一共展示了TimeRange.Move方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MoveTest
public void MoveTest()
{
TimeRange timeRangeMoveZero = new TimeRange( start, end );
timeRangeMoveZero.Move( TimeSpan.Zero );
Assert.AreEqual( timeRangeMoveZero.Start, start );
Assert.AreEqual( timeRangeMoveZero.End, end );
Assert.AreEqual( timeRangeMoveZero.Duration, duration );
TimeRange timeRangeMoveForward = new TimeRange( start, end );
TimeSpan forwardOffset = new TimeSpan( 2, 30, 15 );
timeRangeMoveForward.Move( forwardOffset );
Assert.AreEqual( timeRangeMoveForward.Start, start.Add( forwardOffset ) );
Assert.AreEqual( timeRangeMoveForward.End, end.Add( forwardOffset ) );
TimeRange timeRangeMoveBackward = new TimeRange( start, end );
TimeSpan backwardOffset = new TimeSpan( -1, 10, 30 );
timeRangeMoveBackward.Move( backwardOffset );
Assert.AreEqual( timeRangeMoveBackward.Start, start.Add( backwardOffset ) );
Assert.AreEqual( timeRangeMoveBackward.End, end.Add( backwardOffset ) );
}
示例2: IsSamePeriodTest
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 ) );
}