private void FindCheckedNodes(TestSuiteTreeNode node, bool topLevel) { if (node.Checked) { checkedTests.Add(new CheckedTestInfo(node.Test, topLevel)); topLevel = false; } FindCheckedNodes(node.Nodes, topLevel); }
/// <summary> /// Gets the Theory node associated with the current /// node. If the current node is a Theory, then the /// current node is returned. Otherwise, if the current /// node is a test case under a theory node, then that /// node is returned. Otherwise, null is returned. /// </summary> /// <returns></returns> public TestSuiteTreeNode GetTheoryNode() { if (this.Test.Type == "Theory") { return(this); } TestSuiteTreeNode parent = this.Parent as TestSuiteTreeNode; if (parent != null && parent.Test.Type == "Theory") { return(parent); } return(null); }
public void ShowPropertiesDialog(TestSuiteTreeNode node) { TestPropertiesDialog.DisplayProperties(node); }
public abstract void Visit(TestSuiteTreeNode node);
private void WireUpEvents() { tree.MouseDoubleClick += (s, e) => { ContextNode = tree.GetNodeAt(e.X, e.Y) as TestSuiteTreeNode; if (ContextNode.TestType == "TestCase") { Delegate eventDelegate = (Delegate)RunCommand.GetType().GetField("Execute", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(RunCommand); eventDelegate.Method.Invoke(eventDelegate.Target, null); } }; tree.MouseDown += (s, e) => { if (e.Button == MouseButtons.Right) { ContextNode = tree.GetNodeAt(e.X, e.Y) as TestSuiteTreeNode; } }; tree.AfterSelect += (s, e) => { if (_propertiesDialog != null) { if (_propertiesDialog.Pinned) { _propertiesDialog.DisplayProperties((TestSuiteTreeNode)e.Node); } else { _propertiesDialog.Close(); } } }; tree.DragDrop += (s, e) => { if (IsValidFileDrop(e.Data)) { FileDrop?.Invoke((string[])e.Data.GetData(DataFormats.FileDrop)); } }; tree.DragEnter += (s, e) => { e.Effect = IsValidFileDrop(e.Data) ? DragDropEffects.Copy : DragDropEffects.None; }; treeMenu.Popup += (s, e) => { TestSuiteTreeNode targetNode = ContextNode ?? (TestSuiteTreeNode)tree.SelectedNode; TestSuiteTreeNode theoryNode = targetNode?.GetTheoryNode(); runMenuItem.DefaultItem = runMenuItem.Enabled && targetNode != null && targetNode.Included && (targetNode.Test.RunState == RunState.Runnable || targetNode.Test.RunState == RunState.Explicit); showCheckBoxesMenuItem.Checked = tree.CheckBoxes; //failedAssumptionsMenuItem.Visible = failedAssumptionsMenuItem.Enabled = theoryNode != null; failedAssumptionsMenuItem.Checked = theoryNode?.ShowFailedAssumptions ?? false; propertiesMenuItem.Enabled = targetNode != null; }; treeMenu.Collapse += (s, e) => ContextNode = null; }
public override void Visit(TestSuiteTreeNode node) { node.Included = filter.Pass(node.Test); }