本文整理汇总了C#中Microsoft.Msagl.Core.Layout.Node.IsDescendantOf方法的典型用法代码示例。如果您正苦于以下问题:C# Node.IsDescendantOf方法的具体用法?C# Node.IsDescendantOf怎么用?C# Node.IsDescendantOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Msagl.Core.Layout.Node
的用法示例。
在下文中一共展示了Node.IsDescendantOf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsDescendantOf_ManyParents
public void IsDescendantOf_ManyParents()
{
Cluster grandMother = new Cluster();
Cluster grandFather = new Cluster();
Cluster parent = new Cluster();
Cluster uncle = new Cluster();
grandMother.AddChild(parent);
grandMother.AddChild(uncle);
grandFather.AddChild(parent);
grandFather.AddChild(uncle);
Node child = new Node();
parent.AddChild(child);
Assert.IsTrue(child.IsDescendantOf(parent), "The child node should be considered a descendant of its parent.");
Assert.IsTrue(child.IsDescendantOf(grandMother), "The child node should be considered a descendant of its grandmother.");
Assert.IsTrue(child.IsDescendantOf(grandFather), "The child node should be considered a descendant of its grandfather.");
Assert.IsFalse(child.IsDescendantOf(uncle), "The child node should not be considered a descendant of its uncle.");
}
示例2: IsDescendantOf_BasicTest
public void IsDescendantOf_BasicTest()
{
Cluster cluster = new Cluster();
Node node = new Node();
Node node2 = new Node();
cluster.AddChild(node);
Assert.IsTrue(node.IsDescendantOf(cluster), "Node is a descendant of cluster but IsDescendantOf returns false.");
Assert.IsFalse(node2.IsDescendantOf(cluster), "Node2 is not a descendant of cluster but IsDescendantOf returns true.");
Assert.IsFalse(cluster.IsDescendantOf(cluster), "A cluster should not be considered a descendant of itself.");
}