private ITestComponent FindNextTestGroup(ITestComponent testGroup)
        {
            if (testGroup != null)
            {
                if (testCollection[testGroup].Any())
                {
                    testGroup.EnableTest(true);
                    return(FindInnerTestGroup(testGroup));
                }

                testCollection.Remove(testGroup);
                testGroup.EnableTest(false);

                var parentTestGroup = testGroup.GetTestGroup();

                if (parentTestGroup == null)
                {
                    return(null);
                }

                testCollection[parentTestGroup].Remove(testGroup);
                return(FindNextTestGroup(parentTestGroup));
            }

            throw new Exception("No test left");
        }
 private void AddTestToList(ITestComponent test)
 {
     var group = test.GetTestGroup();
     if (!testCollection.ContainsKey(group))
         testCollection.Add(group, new HashSet<ITestComponent>());
     testCollection[group].Add(test);
     if (group == TestComponent.NullTestComponent) return;
     AddTestToList(group);
 }
        private void AddTestToList(ITestComponent test)
        {
            ITestComponent testGroup = test.GetTestGroup();

            if (!testCollection.ContainsKey(testGroup))
            {
                testCollection.Add(testGroup, new HashSet <ITestComponent>());
            }
            testCollection[testGroup].Add(test);
            if (testGroup != TestComponent.NullTestComponent)
            {
                AddTestToList(testGroup);
            }
        }
        private void AddTestToList(ITestComponent test)
        {
            var group = test.GetTestGroup();

            if (!testCollection.ContainsKey(group))
            {
                testCollection.Add(group, new HashSet <ITestComponent>());
            }
            testCollection[group].Add(test);
            if (group == TestComponent.NullTestComponent)
            {
                return;
            }
            AddTestToList(group);
        }
        private ITestComponent FindNextTestGroup(ITestComponent testGroup)
        {
            if (testGroup == null) 
                throw new Exception ("No test left");

            if (testCollection[testGroup].Any())
            {
                testGroup.EnableTest(true);
                return FindInnerTestGroup(testGroup);
            }
            testCollection.Remove(testGroup);
            testGroup.EnableTest(false);

            var parentTestGroup = testGroup.GetTestGroup();
            if (parentTestGroup == null) return null;

            testCollection[parentTestGroup].Remove(testGroup);
            return FindNextTestGroup(parentTestGroup);
        }
        private ITestComponent FindNextTestGroup(ITestComponent testGroup)
        {
            if (testGroup == null)
            {
                throw new Exception("No test left");
            }
            if (testCollection[testGroup].Any())
            {
                testGroup.EnableTest(enable: true);
                return(FindInnerTestGroup(testGroup));
            }
            testCollection.Remove(testGroup);
            testGroup.EnableTest(enable: false);
            ITestComponent testGroup2 = testGroup.GetTestGroup();

            if (testGroup2 == null)
            {
                return(null);
            }
            testCollection[testGroup2].Remove(testGroup);
            return(FindNextTestGroup(testGroup2));
        }