本文整理汇总了C#中SourceRange.OverlapsWith方法的典型用法代码示例。如果您正苦于以下问题:C# SourceRange.OverlapsWith方法的具体用法?C# SourceRange.OverlapsWith怎么用?C# SourceRange.OverlapsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SourceRange
的用法示例。
在下文中一共展示了SourceRange.OverlapsWith方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestOverlaps
public void TestOverlaps()
{
SourcePosition loc1 = new SourcePosition(0, 1, 1);
SourcePosition loc2 = new SourcePosition(2, 1, 3);
SourcePosition loc3 = new SourcePosition(5, 1, 6);
SourcePosition loc4 = new SourcePosition(6, 1, 7);
SourcePosition loc5 = new SourcePosition(9, 2, 14);
SourceRange range1 = new SourceRange(loc2, loc4);
SourceRange range2 = new SourceRange(loc1, loc1);
SourceRange range3 = new SourceRange(loc1, loc2);
SourceRange range4 = new SourceRange(loc1, loc3);
SourceRange range5 = new SourceRange(loc1, loc4);
SourceRange range6 = new SourceRange(loc1, loc5);
SourceRange range7 = new SourceRange(loc2, loc2);
SourceRange range8 = new SourceRange(loc3, loc3);
Assert.AreEqual(false, SourceRange.Unknown.OverlapsWith(SourceRange.Unknown));
Assert.AreEqual(SourceRange.Unknown, SourceRange.Unknown.Overlap(SourceRange.Unknown));
Assert.AreEqual(false, range1.OverlapsWith(SourceRange.Unknown));
Assert.AreEqual(SourceRange.Unknown, range1.Overlap(SourceRange.Unknown));
Assert.AreEqual(false, range1.OverlapsWith(range2));
Assert.AreEqual(SourceRange.Unknown, range1.Overlap(range2));
Assert.AreEqual(true, range1.OverlapsWith(range3));
Assert.AreEqual(new SourceRange(loc2), range1.Overlap(range3));
Assert.AreEqual(true, range1.OverlapsWith(range4));
Assert.AreEqual(new SourceRange(loc2, loc3), range1.Overlap(range4));
Assert.AreEqual(true, range1.OverlapsWith(range5));
Assert.AreEqual(range1, range1.Overlap(range5));
Assert.AreEqual(true, range1.OverlapsWith(range6));
Assert.AreEqual(range1, range1.Overlap(range6));
Assert.AreEqual(true, range1.OverlapsWith(range7));
Assert.AreEqual(range7, range1.Overlap(range7));
Assert.AreEqual(true, range1.OverlapsWith(range8));
Assert.AreEqual(range8, range1.Overlap(range8));
}