Exemplo n.º 1
0
 private void OnTestErrorAsync(object sender, TestResultEventArgs args)
 {
     lock (this) {
         SmartTreeNode assemblyNode = FindAssemblyNode(sender as ITestAssembly);
         SmartTreeNode node         = FindTestMethodNode(assemblyNode.Nodes, args.ClassName + "." + args.MethodName);
         if (node == null)
         {
             node = FindTestFixtureNode(assemblyNode.Nodes, args.ClassName);
         }
         AddCommentNode(ref node, string.Format("File {0}, Line {1}",
                                                args.FileName.Substring(args.FileName.LastIndexOf("\\") + 1),
                                                args.LineNumber));
         SmartTreeNode commentNode = AddCommentNode(ref node, "Error: " + args.Reason);
         SetNodeError(ref node, Constants.ColorError);
         if (_config.ExpandCommentNodes)
         {
             commentNode.ExpandAll();
             commentNode.LastNode.EnsureVisible();
         }
         else
         {
             node.EnsureVisible();
         }
     }
 }
Exemplo n.º 2
0
 private void OnTestPassedAsync(object sender, TestResultEventArgs args)
 {
     lock (this) {
         SmartTreeNode assemblyNode = FindAssemblyNode(sender as ITestAssembly);
         SmartTreeNode node         = FindTestMethodNode(assemblyNode.Nodes, args.ClassName + "." + args.MethodName);
         SetNodeSuccess(ref node);
         if (node.IsVisible)
         {
             node.EnsureVisible();
         }
         else
         {
             SmartTreeNode parent = node.Parent;
             while (parent != null)
             {
                 if (parent.IsVisible)
                 {
                     parent.EnsureVisible();
                     break;
                 }
                 else
                 {
                     parent = parent.Parent;
                 }
             }
         }
     }
 }
Exemplo n.º 3
0
 private void RestoreCheckState(SmartTreeNode root)
 {
     if ((root.Tag as UiElementInfo) != null)
     {
         UiElementInfo element = root.Tag as UiElementInfo;
         root.Checked = _checkedTestSelector.Contains(element);
         if (root.Checked)
         {
             root.EnsureVisible();
         }
     }
     foreach (SmartTreeNode node in root.Nodes)
     {
         RestoreCheckState(node);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Sets the background color of a node to green. If any of the parent
 /// nodes has no background color yet, their color is set to green as
 /// well.
 /// </summary>
 /// <param name="node">The node to start with.</param>
 private static void SetNodeSuccess(ref SmartTreeNode node)
 {
     if (node.ImageIndex < 5)
     {
         node.ImageIndex += 5;
     }
     node.SelectedImageIndex = node.ImageIndex;
     if (node.Parent != null)
     {
         SmartTreeNode parent = node.Parent;
         SetNodeSuccess(ref parent);
     }
     if (RecipeFactory.Current.TestRunKind == TestRunKind.RunChecked &&
         node.Checked)
     {
         node.EnsureVisible();
     }
 }