本文整理汇总了C#中TreeNodeCollection.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNodeCollection.Contains方法的具体用法?C# TreeNodeCollection.Contains怎么用?C# TreeNodeCollection.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeNodeCollection
的用法示例。
在下文中一共展示了TreeNodeCollection.Contains方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddNodeTestCase1
public void AddNodeTestCase1()
{
var parent = new TreeNode<String>();
var target = new TreeNodeCollection<String>( parent );
var item = new TreeNode<String>();
target.Add( item, false );
Assert.IsTrue( target.Contains( item ) );
Assert.AreEqual( 1, target.Count );
Assert.IsNull( item.Parent );
Assert.AreEqual( 0, item.Depth );
}
示例2: RemoveNodeTestCase2
public void RemoveNodeTestCase2()
{
var parent = new TreeNode<String>();
var target = new TreeNodeCollection<String>( parent );
var item = new TreeNode<String>();
target.Add( item );
var item1 = new TreeNode<String>();
target.Add( item1 );
var result = target.Remove( item, false );
Assert.IsTrue( result );
Assert.AreSame( parent, item.Parent );
Assert.IsFalse( target.Contains( item ) );
result = target.Remove( item1, false );
Assert.IsTrue( result );
Assert.AreSame( parent, item1.Parent );
Assert.IsFalse( target.Contains( item1 ) );
Assert.AreEqual( 0, target.Count );
}
示例3: RemoveNodeTestCase1
public void RemoveNodeTestCase1()
{
var parent = new TreeNode<String>();
var target = new TreeNodeCollection<String>( parent );
var item = new TreeNode<String> { Parent = parent };
var result = target.Remove( item );
Assert.IsFalse( result );
Assert.AreSame( parent, item.Parent );
Assert.IsFalse( target.Contains( item ) );
}
示例4: AddValueTestCase2
public void AddValueTestCase2()
{
var parent = new TreeNode<String>();
var target = new TreeNodeCollection<String>( parent );
var expected = RandomValueEx.GetRandomString();
var actual = target.Add( expected );
var actual1 = target.Add( expected );
Assert.AreEqual( 2, target.Count );
Assert.IsTrue( target.Contains( actual ) );
Assert.IsTrue( target.Contains( actual1 ) );
Assert.AreSame( parent, actual.Parent );
Assert.AreEqual( actual.Value, expected );
Assert.AreEqual( 1, actual.Depth );
Assert.AreSame( parent, actual1.Parent );
Assert.AreEqual( actual1.Value, expected );
Assert.AreEqual( 1, actual1.Depth );
}
示例5: AddValueTestCase1
public void AddValueTestCase1()
{
var parent = new TreeNode<String>();
var target = new TreeNodeCollection<String>( parent );
String expected = null;
var actual = target.Add( expected );
Assert.IsTrue( target.Contains( actual ) );
Assert.AreEqual( 1, target.Count );
Assert.AreEqual( actual.Value, expected );
Assert.AreSame( parent, actual.Parent );
Assert.AreEqual( 1, actual.Depth );
}