コード例 #1
0
        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));
            });
        }
コード例 #2
0
 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"));
 }
コード例 #3
0
        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());
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        // 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);
        }
コード例 #7
0
        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());
        }
コード例 #8
0
 public string GroupDisplayName(TestGroup group)
 {
     return(string.Format("{0} ({1})", group.Name, group.Count));
 }