예제 #1
0
        private TestSuite BuildTestAssembly(Assembly assembly, IList <TestFixture> fixtures)
        {
            string assemblyPath = AssemblyHelper.GetAssemblyPath(assembly);

            TestSuite testAssembly = new TestAssembly(assembly, assemblyPath);

            testAssembly.Seed = Randomizer.InitialSeed;

            foreach (Test fixture in fixtures)
            {
                testAssembly.Add(fixture);
            }

            if (fixtures.Count == 0)
            {
                testAssembly.RunState = RunState.NotRunnable;
                testAssembly.Properties.Set(PropertyNames.SkipReason, "Has no TestFixtures");
            }

            testAssembly.ApplyAttributesToTest(assembly);

            testAssembly.Properties.Set(PropertyNames.ProcessID, System.Diagnostics.Process.GetCurrentProcess().Id);
            testAssembly.Properties.Set(PropertyNames.AppDomain, AppDomain.CurrentDomain.FriendlyName);

            return(testAssembly);
        }
예제 #2
0
        private TestSuite BuildTestAssembly(string assemblyName, IList fixtures, bool autoSuites)
        {
            TestSuite testAssembly = new TestAssembly(assemblyName);

            if (autoSuites)
            {
                NamespaceTreeBuilder treeBuilder =
                    new NamespaceTreeBuilder(testAssembly);
                treeBuilder.Add(fixtures);
                testAssembly = treeBuilder.RootSuite;
            }
            else
            {
                foreach (TestSuite fixture in fixtures)
                {
                    if (fixture != null)
                    {
                        if (fixture is SetUpFixture)
                        {
                            fixture.RunState     = RunState.NotRunnable;
                            fixture.IgnoreReason = "SetUpFixture cannot be used when loading tests as a flat list of fixtures";
                        }

                        testAssembly.Add(fixture);
                    }
                }
            }

            if (fixtures.Count == 0)
            {
                testAssembly.RunState     = RunState.NotRunnable;
                testAssembly.IgnoreReason = "Has no TestFixtures";
            }

            NUnitFramework.ApplyCommonAttributes(assembly, testAssembly);

            testAssembly.Properties["_PID"]       = System.Diagnostics.Process.GetCurrentProcess().Id;
            testAssembly.Properties["_APPDOMAIN"] = AppDomain.CurrentDomain.FriendlyName;


            // TODO: Make this an option? Add Option to sort assemblies as well?
            testAssembly.Sort();

            return(testAssembly);
        }
예제 #3
0
        private TestSuite BuildTestAssembly( string assemblyName, IList fixtures, bool autoSuites )
        {
            TestSuite testAssembly = new TestAssembly( assemblyName );

            if ( autoSuites )
            {
                NamespaceTreeBuilder treeBuilder =
                    new NamespaceTreeBuilder( testAssembly );
                treeBuilder.Add( fixtures );
                testAssembly = treeBuilder.RootSuite;
            }
            else
            foreach( TestSuite fixture in fixtures )
            {
                if (fixture != null)
                {
                    if (fixture is SetUpFixture)
                    {
                        fixture.RunState = RunState.NotRunnable;
                        fixture.IgnoreReason = "SetUpFixture cannot be used when loading tests as a flat list of fixtures";
                    }

                    testAssembly.Add(fixture);
                }
            }

            if ( fixtures.Count == 0 )
            {
                testAssembly.RunState = RunState.NotRunnable;
                testAssembly.IgnoreReason = "Has no TestFixtures";
            }

            NUnitFramework.ApplyCommonAttributes( assembly, testAssembly );

            testAssembly.Properties["_PID"] = System.Diagnostics.Process.GetCurrentProcess().Id;
            testAssembly.Properties["_APPDOMAIN"] = AppDomain.CurrentDomain.FriendlyName;

            // TODO: Make this an option? Add Option to sort assemblies as well?
            testAssembly.Sort();

            return testAssembly;
        }