1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
5
using ICSharpCode.Core;
7
namespace ICSharpCode.UnitTesting
10
/// All Tests root tree node that is added to the test tree when the
11
/// solution has multiple test projects.
13
public class AllTestsTreeNode : TestTreeNode
15
public AllTestsTreeNode()
16
: base(null, StringParser.Parse("${res:ICSharpCode.UnitTesting.AllTestsTreeNode.Text}"))
21
/// Raised when the all tests tree node is disposed.
23
public event EventHandler Disposed;
26
/// Disposes this tree node.
28
public override void Dispose()
31
if (Disposed != null) {
32
Disposed(this, new EventArgs());
37
/// Adds a new project node as a child of the All Tests node.
39
public void AddProjectNode(TestProjectTreeNode node)
42
node.ImageIndexChanged += TestProjectTreeNodeImageIndexChanged;
46
/// Removes the project node.
48
public void RemoveProjectNode(TestProjectTreeNode node)
50
if (Nodes.Contains(node)) {
51
node.ImageIndexChanged -= TestProjectTreeNodeImageIndexChanged;
56
void TestProjectTreeNodeImageIndexChanged(object source, EventArgs e)
58
UpdateImageListIndex();
62
/// Sets the All Tests image index based on the current image
63
/// indexes of the child project tree nodes.
65
void UpdateImageListIndex()
71
int total = Nodes.Count;
73
foreach (TestProjectTreeNode projectNode in Nodes) {
74
switch (projectNode.ImageIndex) {
75
case (int)TestTreeViewImageListIndex.TestFailed:
78
case (int)TestTreeViewImageListIndex.TestPassed:
81
case (int)TestTreeViewImageListIndex.TestIgnored:
90
// Update the image index based on the test project results.
92
UpdateImageListIndex(TestResultType.Failure);
93
} else if (ignored > 0) {
94
UpdateImageListIndex(TestResultType.Ignored);
95
} else if (passed > 0 && notRun == 0) {
96
UpdateImageListIndex(TestResultType.Success);
98
UpdateImageListIndex(TestResultType.None);