Example #1
0
 public void CreateSelection()
 {
     selection = new TestSelection();
     selection.Add(MakeTestNode("1", "Tom", "Passed"));
     selection.Add(MakeTestNode("2", "Dick", "Failed"));
     selection.Add(MakeTestNode("3", "Harry", "Passed"));
 }
Example #2
0
        public TestSelection Select(TestNodePredicate predicate, Comparison <TestNode> comparer)
        {
            var selection = new TestSelection();

            Accumulate(selection, this, predicate);

            if (comparer != null)
            {
                selection.Sort(comparer);
            }

            return(selection);
        }
Example #3
0
 private void Accumulate(TestSelection selection, TestNode testNode, TestNodePredicate predicate)
 {
     if (predicate(testNode))
     {
         selection.Add(testNode);
     }
     else if (testNode.IsSuite)
     {
         foreach (TestNode child in testNode.Children)
         {
             Accumulate(selection, child, predicate);
         }
     }
 }
        public IDictionary <string, TestSelection> GroupBy(GroupingFunction groupingFunction)
        {
            var groups = new Dictionary <string, TestSelection>();

            foreach (TestNode testNode in this)
            {
                var groupName = groupingFunction(testNode);

                TestSelection group = null;
                if (!groups.ContainsKey(groupName))
                {
                    group             = new TestSelection();
                    groups[groupName] = group;
                }
                else
                {
                    group = groups[groupName];
                }

                group.Add(testNode);
            }

            return(groups);
        }