Exemplo n.º 1
0
        private UnitTestRendererLine[] ParseTestList(Test test, List<UnitTestResult> results, HashSet<string> categories)
        {
            foreach (string category in test.Categories)
                categories.Add(category);

            if (test is TestMethod)
            {
                var result = new UnitTestResult
                {
                    Test = new UnitTestInfo(test as TestMethod)
                };

                results.Add(result);
                return new[] { new TestLine(test as TestMethod, result.Id) };
            }

            GroupLine group = null;
            if (test is TestSuite)
                group = new GroupLine(test as TestSuite);

            var namespaceList = new List<UnitTestRendererLine>(new[] {group});

            foreach (Test result in test.Tests)
            {
                if (result is NamespaceSuite || test is TestAssembly)
                    namespaceList.AddRange(ParseTestList(result, results, categories));
                else
                    group.AddChildren(ParseTestList(result, results, categories));
            }

            namespaceList.Sort();
            return namespaceList.ToArray();
        }
Exemplo n.º 2
0
        private UnitTestRendererLine[] ParseTestList(Test test, List <UnitTestResult> results, HashSet <string> categories)
        {
            foreach (string category in test.Categories)
            {
                categories.Add(category);
            }

            if (test is TestMethod)
            {
                var result = new UnitTestResult()
                {
                    Test = new UnitTestInfo(test as TestMethod)
                };

                results.Add(result);
                return(new[] { new TestLine(test as TestMethod, result.Id) });
            }

            GroupLine group = null;

            if (test is TestSuite)
            {
                group = new GroupLine(test as TestSuite);
            }

            var namespaceList = new List <UnitTestRendererLine> (new [] { group });

            foreach (Test result in test.Tests)
            {
                if (result is NamespaceSuite || test is TestAssembly)
                {
                    namespaceList.AddRange(ParseTestList(result, results, categories));
                }

                else
                {
                    group.AddChildren(ParseTestList(result, results, categories));
                }
            }

            namespaceList.Sort();
            return(namespaceList.ToArray());
        }