本文整理汇总了C#中TimeInterval.IntersectsWith方法的典型用法代码示例。如果您正苦于以下问题:C# TimeInterval.IntersectsWith方法的具体用法?C# TimeInterval.IntersectsWith怎么用?C# TimeInterval.IntersectsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeInterval
的用法示例。
在下文中一共展示了TimeInterval.IntersectsWith方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}