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