本文整理汇总了C#中TimeInterval.GetRelation方法的典型用法代码示例。如果您正苦于以下问题:C# TimeInterval.GetRelation方法的具体用法?C# TimeInterval.GetRelation怎么用?C# TimeInterval.GetRelation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeInterval
的用法示例。
在下文中一共展示了TimeInterval.GetRelation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DefaultTest
public void DefaultTest() {
TimeInterval timeInterval = new TimeInterval();
Assert.AreNotEqual(timeInterval, TimeInterval.Anytime);
Assert.AreEqual(timeInterval.GetRelation(TimeInterval.Anytime), PeriodRelation.ExactMatch);
Assert.IsTrue(timeInterval.IsAnytime);
Assert.IsTrue(timeInterval.IsClosed);
Assert.IsFalse(timeInterval.IsOpen);
Assert.IsFalse(timeInterval.IsMoment);
Assert.IsFalse(timeInterval.IsReadOnly);
}
示例2: TouchingIntervalTest
public void TouchingIntervalTest() {
TimeInterval timeInterval1 = new TimeInterval(start, end);
TimeInterval timeInterval2 = new TimeInterval(end, end.AddHours(1));
Assert.AreNotEqual(timeInterval1.GetIntersection(timeInterval2), null);
Assert.AreEqual(timeInterval1.IntersectsWith(timeInterval2), true);
Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.EndTouching);
Assert.AreEqual(timeInterval2.GetRelation(timeInterval1), PeriodRelation.StartTouching);
timeInterval1.EndEdge = IntervalEdge.Open;
Assert.AreEqual(timeInterval1.GetIntersection(timeInterval2), null);
Assert.AreEqual(timeInterval1.IntersectsWith(timeInterval2), false);
Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.Before);
Assert.AreEqual(timeInterval2.GetRelation(timeInterval1), PeriodRelation.After);
timeInterval1.EndEdge = IntervalEdge.Closed;
Assert.AreNotEqual(timeInterval1.GetIntersection(timeInterval2), null);
Assert.AreEqual(timeInterval1.IntersectsWith(timeInterval2), true);
Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.EndTouching);
Assert.AreEqual(timeInterval2.GetRelation(timeInterval1), PeriodRelation.StartTouching);
timeInterval2.StartEdge = IntervalEdge.Open;
Assert.AreEqual(timeInterval1.GetIntersection(timeInterval2), null);
Assert.AreEqual(timeInterval1.IntersectsWith(timeInterval2), false);
Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.Before);
Assert.AreEqual(timeInterval2.GetRelation(timeInterval1), PeriodRelation.After);
timeInterval2.StartEdge = IntervalEdge.Closed;
Assert.AreNotEqual(timeInterval1.GetIntersection(timeInterval2), null);
Assert.AreEqual(timeInterval1.IntersectsWith(timeInterval2), true);
Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.EndTouching);
Assert.AreEqual(timeInterval2.GetRelation(timeInterval1), PeriodRelation.StartTouching);
}
示例3: IsIntervalEnabledTest
public void IsIntervalEnabledTest() {
TimeInterval timeInterval1 = new TimeInterval(start, end);
TimeInterval timeInterval2 = new TimeInterval(end, end.AddHours(1));
Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.EndTouching);
timeInterval1.EndEdge = IntervalEdge.Open;
Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.Before);
timeInterval1.IsIntervalEnabled = false;
Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.EndTouching);
timeInterval1.IsIntervalEnabled = true;
Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.Before);
timeInterval1.EndEdge = IntervalEdge.Closed;
Assert.AreEqual(timeInterval1.GetRelation(timeInterval2), PeriodRelation.EndTouching);
}