private void AddGroup(TestGroup group) { Groups.Add(group); Groups.Sort((x, y) => { bool xNone = x.Name == "None"; bool yNone = y.Name == "None"; if (xNone && yNone) { return(0); } if (xNone) { return(1); } if (yNone) { return(-1); } return(x.Name.CompareTo(y.Name)); }); }
public void CreateTestGroup() { _group = new TestGroup("NAME", 7); _group.Add(MakeTestNode("1", "Tom", "Runnable")); _group.Add(MakeTestNode("2", "Dick", "Explicit")); _group.Add(MakeTestNode("3", "Harry", "Runnable")); }
protected override TestGroup[] SelectGroups(TestNode testNode) { List <TestGroup> groups = new List <TestGroup>(); string xpathExpression = "properties/property[@name='Category']"; if (_includeAncestors) { xpathExpression = "ancestor-or-self::*/" + xpathExpression; } foreach (XmlNode node in testNode.Xml.SelectNodes(xpathExpression)) { var groupName = node.Attributes["value"].Value; var group = Groups.Find((g) => g.Name == groupName);//GetGroup(groupName); if (group == null) { group = new TestGroup(groupName); Groups.Add(group); } groups.Add(group); } if (groups.Count == 0) { groups.Add(Groups[0]); } return(groups.ToArray()); }
protected TreeNode MakeTreeNode(TestGroup group, bool recursive) { TreeNode treeNode = new TreeNode(GroupDisplayName(group), group.ImageIndex, group.ImageIndex); treeNode.Tag = group; if (recursive) { foreach (TestNode test in group) { treeNode.Nodes.Add(MakeTreeNode(test, true)); } } return(treeNode); }
private void DebugCheckedTests() { var tests = new TestGroup("DebugTests"); foreach (var treeNode in _view.Tree.CheckedNodes) { var testNode = treeNode.Tag as TestNode; if (testNode != null) { tests.Add(testNode); } else { var group = treeNode.Tag as TestGroup; if (group != null) { tests.AddRange(group); } } } _model.DebugTests(tests); }
// TODO: Move this to TestGroup? Would need access to results. public int CalcImageIndexForGroup(TestGroup group) { var groupIndex = -1; foreach (var testNode in group) { var result = GetResultForTest(testNode); if (result != null) { var imageIndex = CalcImageIndex(result.Outcome); if (imageIndex == TestTreeView.FailureIndex) { return(TestTreeView.FailureIndex); // Early return - can't get any worse! } if (imageIndex >= TestTreeView.SuccessIndex) // Only those values propagate { groupIndex = Math.Max(groupIndex, imageIndex); } } } return(groupIndex); }
protected override TestGroup[] SelectGroups(TestNode testNode) { List <TestGroup> groups = new List <TestGroup>(); foreach (XmlNode node in testNode.Xml.SelectNodes("properties/property[@name='Category']")) { var groupName = node.Attributes["value"].Value; var group = Groups.Find((g) => g.Name == groupName);//GetGroup(groupName); if (group == null) { group = new TestGroup(groupName); Groups.Add(group); } groups.Add(group); } if (groups.Count == 0) { groups.Add(Groups[0]); } return(groups.ToArray()); }
public string GroupDisplayName(TestGroup group) { return(string.Format("{0} ({1})", group.Name, group.Count)); }