本文整理汇总了C#中NUnit.UiKit.TestSuiteTreeNode类的典型用法代码示例。如果您正苦于以下问题:C# TestSuiteTreeNode类的具体用法?C# TestSuiteTreeNode怎么用?C# TestSuiteTreeNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestSuiteTreeNode类属于NUnit.UiKit命名空间,在下文中一共展示了TestSuiteTreeNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestPropertiesDialog
public TestPropertiesDialog( TestSuiteTreeNode node )
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
this.node = node;
}
示例2: Visit
public override void Visit(TestSuiteTreeNode node)
{
if (!node.Test.IsSuite && node.HasResult &&
(node.Result.ResultState == ResultState.Failure ||
node.Result.ResultState == ResultState.Error) )
{
tests.Add(node.Test);
}
}
示例3: HideTestsUnderNode
/// <summary>
/// Helper collapses all fixtures under a node
/// </summary>
/// <param name="node">Node under which to collapse fixtures</param>
private void HideTestsUnderNode( TestSuiteTreeNode node )
{
bool expand = false;
foreach( TestSuiteTreeNode child in node.Nodes )
if ( child.Test.IsSuite )
{
expand = true;
HideTestsUnderNode( child );
}
if ( expand )
node.Expand();
else
node.Collapse();
}
示例4: OnMouseDown
/// <summary>
/// Handles right mouse button down by
/// remembering the proper context item
/// and implements multiple select with the left button.
/// </summary>
/// <param name="e">MouseEventArgs structure with information about the mouse position and button state</param>
protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Right )
{
CheckPropertiesDialog();
TreeNode theNode = GetNodeAt( e.X, e.Y );
contextNode = theNode as TestSuiteTreeNode;
}
// else if (e.Button == MouseButtons.Left )
// {
// if ( Control.ModifierKeys == Keys.Control )
// {
// TestSuiteTreeNode theNode = GetNodeAt( e.X, e.Y ) as TestSuiteTreeNode;
// if ( theNode != null )
// theNode.IsSelected = true;
// }
// else
// {
// ClearSelected();
// }
// }
base.OnMouseDown( e );
}
示例5: AddTreeNodes
/// <summary>
/// Add nodes to the tree constructed from a test
/// </summary>
/// <param name="nodes">The TreeNodeCollection to which the new node should be added</param>
/// <param name="rootTest">The test for which a node is to be built</param>
/// <param name="highlight">If true, highlight the text for this node in the tree</param>
/// <returns>A newly constructed TestNode, possibly with descendant nodes</returns>
private TestSuiteTreeNode AddTreeNodes( IList nodes, TestNode rootTest, bool highlight )
{
TestSuiteTreeNode node = new TestSuiteTreeNode( rootTest );
// if ( highlight ) node.ForeColor = Color.Blue;
AddToMap( node );
nodes.Add( node );
if ( rootTest.IsSuite )
{
foreach( TestNode test in rootTest.Tests )
AddTreeNodes( node.Nodes, test, highlight );
}
return node;
}
示例6: Visit
public override void Visit(TestSuiteTreeNode node)
{
node.Checked = false;
}
示例7: ProcessTreeNodes
private void ProcessTreeNodes(TestSuiteTreeNode node)
{
if (IsInteresting(node))
this.Nodes.Add(new VisualTreeNode(node));
foreach (TestSuiteTreeNode childNode in node.Nodes)
ProcessTreeNodes(childNode);
}
示例8: IsInteresting
private bool IsInteresting(TestSuiteTreeNode node)
{
return node.IsExpanded || node.Checked;
}
示例9: NodeWasDeleted
/// <summary>
/// Helper returns true if the node test is not in
/// the list of tests provided.
/// </summary>
/// <param name="node">Node to examine</param>
/// <param name="tests">List of tests to match with node</param>
private bool NodeWasDeleted( TestSuiteTreeNode node, IList tests )
{
foreach ( TestNode test in tests )
if( Match( node, test ) )
return false;
return true;
}
示例10: VisualTreeNode
public VisualTreeNode( TestSuiteTreeNode treeNode )
{
this.UniqueName = treeNode.Test.TestName.UniqueName;
this.Expanded = treeNode.IsExpanded;
this.Checked = treeNode.Checked;
}
示例11: UpdateNodes
/// <summary>
/// Match a set of nodes against a set of tests.
/// Remove nodes that are no longer represented
/// in the tests. Update any nodes that match.
/// Add new nodes for new tests.
/// </summary>
/// <param name="nodes">List of nodes to be matched</param>
/// <param name="tests">List of tests to be matched</param>
/// <param name="deletedNodes">List of nodes previously removed,
/// in case they show up lower in the tree.</param>
/// <returns>True if the parent should expand to show that something was added or deleted</returns>
private bool UpdateNodes( IList nodes, IList tests, IList deletedNodes )
{
// As of NUnit 2.3.6006, the newly reloaded tests
// are guaranteed to be in the same order as the
// originally loaded tests. Hence, we can merge
// the two lists. However, we can only use an
// equality comparison, since we don't know what
// determines the order. Hence the two passes.
bool showChanges = false;
// Pass1: delete nodes that are not in the list of tests.
// Some of these nodes may reappear lower in the tree,
// if we are switching from fixture display to tree display,
// so we save them for checking later.
int nodeIndex = nodes.Count;
while( --nodeIndex >= 0 )
{
TestSuiteTreeNode node = (TestSuiteTreeNode)nodes[nodeIndex];
if ( NodeWasDeleted( node, tests ) )
{
log.Debug( "Deleting " + node.Test.TestName.Name );
deletedNodes.Add(node);
RemoveNode( node );
showChanges = true;
}
}
// Pass2: All nodes in the node list are also
// in the tests, so we can merge in changes
// and add any new nodes.
nodeIndex = 0;
foreach( TestNode test in tests )
{
TestSuiteTreeNode node = nodeIndex < nodes.Count ? (TestSuiteTreeNode)nodes[nodeIndex] : null;
if ( node != null && node.Test.TestName.FullName == test.TestName.FullName )
UpdateNode( node, test, deletedNodes );
else
{
// Create a new node or use a deleted node
TestSuiteTreeNode newNode = null;
// Check previously deleted nodes
foreach( TestSuiteTreeNode deletedNode in deletedNodes )
if (deletedNode.Test.TestName.FullName == test.TestName.FullName)
{
newNode = deletedNode;
deletedNodes.Remove(deletedNode);
break;
}
// If not found, it's completely new
if (newNode == null)
newNode = new TestSuiteTreeNode(test);
AddToMap( newNode );
nodes.Insert( nodeIndex, newNode );
if ( test.IsSuite )
{
if ( UpdateNodes(newNode.Nodes, test.Tests, deletedNodes) )
newNode.Expand();
//foreach( TestNode childTest in test.Tests )
// AddTreeNodes(newNode.Nodes, childTest, false);
}
showChanges = true;
}
nodeIndex++;
}
return showChanges;
}
示例12: DisplayProperties
public void DisplayProperties(TestSuiteTreeNode node)
{
this.node = node;
this.test = node.Test;
this.result = node.Result;
SetTitleBarText();
testResult.Text = node.StatusText;
testResult.Font = new Font(this.Font, FontStyle.Bold);
if (node.TestType == "Project" || node.TestType == "Assembly")
testName.Text = Path.GetFileName(test.TestName.Name);
else
testName.Text = test.TestName.Name;
testType.Text = node.TestType;
fullName.Text = test.TestName.FullName;
description.Text = test.Description;
StringBuilder sb1 = new StringBuilder();
foreach (string cat in test.Categories)
if (sb1.Length > 0)
{
sb1.Append(", ");
sb1.Append(cat);
}
categories.Text = sb1.ToString();
testCaseCount.Text = test.TestCount.ToString();
switch (test.RunState)
{
case RunState.Explicit:
shouldRun.Text = "Explicit";
break;
case RunState.Runnable:
shouldRun.Text = "Yes";
break;
default:
shouldRun.Text = "No";
break;
}
ignoreReason.Text = test.IgnoreReason;
FillPropertyList();
elapsedTime.Text = "Execution Time:";
assertCount.Text = "Assert Count:";
message.Text = "";
stackTrace.Text = "";
if (result != null)
{
elapsedTime.Text = string.Format("Execution Time: {0}", result.Time);
assertCount.Text = string.Format("Assert Count: {0}", result.AssertCount);
// message may have a leading blank line
// TODO: take care of this in label?
if (result.Message != null)
{
if (result.Message.Length > 64000)
message.Text = TrimLeadingBlankLines(result.Message.Substring(0, 64000));
else
message.Text = TrimLeadingBlankLines(result.Message);
}
stackTrace.Text = result.StackTrace;
}
BeginPanel();
CreateRow(testTypeLabel, testType);
CreateRow(fullNameLabel, fullName);
CreateRow(descriptionLabel, description);
CreateRow(categoriesLabel, categories);
CreateRow(testCaseCountLabel, testCaseCount, shouldRunLabel, shouldRun);
CreateRow(ignoreReasonLabel, ignoreReason);
CreateRow(propertiesLabel, properties);
CreateRow(hiddenProperties);
groupBox1.ClientSize = new Size(
groupBox1.ClientSize.Width, maxY + 12);
groupBox2.Location = new Point(
groupBox1.Location.X, groupBox1.Bottom + 12);
BeginPanel();
CreateRow(elapsedTime, assertCount);
CreateRow(messageLabel, message);
CreateRow(stackTraceLabel, stackTrace);
groupBox2.ClientSize = new Size(
groupBox2.ClientSize.Width, this.maxY + 12);
this.ClientSize = new Size(
this.ClientSize.Width, groupBox2.Bottom + 12);
}
示例13: TestPropertiesDialog
public TestPropertiesDialog(TestSuiteTreeNode node)
{
InitializeComponent();
this.node = node;
}
示例14: FindCheckedNodes
private void FindCheckedNodes( TestSuiteTreeNode node, bool topLevel )
{
if ( node.Checked )
{
checkedTests.Add( new CheckedTestInfo( node.Test, topLevel ) );
topLevel = false;
}
FindCheckedNodes( node.Nodes, topLevel );
}
示例15: Match
/// <summary>
/// Helper routine that compares a node with a test
/// </summary>
/// <param name="node">Node to compare</param>
/// <param name="test">Test to compare</param>
/// <returns>True if the test has the same name</returns>
private bool Match( TestSuiteTreeNode node, TestNode test )
{
return node.Test.TestName.FullName == test.TestName.FullName;
}