示例#1
0
        public IEnumerable <UnitTest> BuildTestInfo(DotNetCoreProjectTestSuite projectTestSuite)
        {
            tests.Sort(OrderByName);

            var parentNamespace = new DotNetCoreNamespaceTestGroup(projectTestSuite, null, String.Empty);

            parentNamespace.AddTests(tests);
            return(parentNamespace.Tests);
        }
        public DotNetCoreNamespaceTestGroup(IDotNetCoreTestRunner testRunner, UnitTestGroup parent, string name)
            : base(name)
        {
            currentNamespace = this;
            this.testRunner  = testRunner;

            if (parent == null || String.IsNullOrEmpty(parent.FixtureTypeNamespace))
            {
                FixtureTypeNamespace = name;
            }
            else
            {
                FixtureTypeNamespace = parent.FixtureTypeNamespace + "." + name;
            }
        }
        void AddTest(DotNetCoreUnitTest dotNetCoreTest)
        {
            string childNamespace = dotNetCoreTest.GetChildNamespace(FixtureTypeNamespace);

            if (string.IsNullOrEmpty(childNamespace))
            {
                if (currentClass == null || currentClass.FixtureTypeName != dotNetCoreTest.FixtureTypeName)
                {
                    currentClass = new DotNetCoreTestClass(testRunner, dotNetCoreTest.FixtureTypeName);
                    Tests.Add(currentClass);
                }
                currentClass.Tests.Add(dotNetCoreTest);
            }
            else if (currentNamespace.Name == childNamespace)
            {
                currentNamespace.AddTest(dotNetCoreTest);
            }
            else
            {
                currentNamespace = new DotNetCoreNamespaceTestGroup(testRunner, currentNamespace, childNamespace);
                currentNamespace.AddTest(dotNetCoreTest);
                Tests.Add(currentNamespace);
            }
        }