Ejemplo n.º 1
0
        private TestSuite BuildTestAssembly(Assembly assembly, string assemblyName, IList fixtures)
        {
            TestSuite testAssembly = new TestAssembly(assembly, assemblyName);

            if (fixtures.Count == 0)
            {
                testAssembly.RunState = RunState.NotRunnable;
                testAssembly.Properties.Set(PropertyNames.SkipReason, "Has no TestFixtures");
            }
            else
            {
                NamespaceTreeBuilder treeBuilder =
                    new NamespaceTreeBuilder(testAssembly);
                treeBuilder.Add(fixtures);
                testAssembly = treeBuilder.RootSuite;
            }

            testAssembly.ApplyAttributesToTest(assembly);

#if !PORTABLE
#if !SILVERLIGHT
            testAssembly.Properties.Set(PropertyNames.ProcessID, System.Diagnostics.Process.GetCurrentProcess().Id);
#endif
            testAssembly.Properties.Set(PropertyNames.AppDomain, AppDomain.CurrentDomain.FriendlyName);
#endif

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

            return(testAssembly);
        }
Ejemplo n.º 2
0
        private TestSuite BuildTestAssembly(Assembly assembly, string assemblyNameOrPath, IList <Test> fixtures)
        {
            TestSuite testAssembly = new TestAssembly(assembly, assemblyNameOrPath);

            if (fixtures.Count == 0)
            {
                testAssembly.MakeInvalid("No test fixtures were found.");
            }
            else
            {
                NamespaceTreeBuilder treeBuilder =
                    new NamespaceTreeBuilder(testAssembly);
                treeBuilder.Add(fixtures);
                testAssembly = treeBuilder.RootSuite;
            }

            testAssembly.ApplyAttributesToTest(assembly);

            try
            {
                testAssembly.Properties.Set(PropertyNames.ProcessId, System.Diagnostics.Process.GetCurrentProcess().Id);
            }
            catch (PlatformNotSupportedException)
            { }
            testAssembly.Properties.Set(PropertyNames.AppDomain, AppDomain.CurrentDomain.FriendlyName);

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

            return(testAssembly);
        }
Ejemplo n.º 3
0
        private TestSuite BuildTestAssembly(Assembly assembly, string assemblyName, IList <Test> fixtures)
        {
            TestSuite testAssembly = new TestAssembly(assembly, assemblyName);

            if (fixtures.Count == 0)
            {
                testAssembly.MakeInvalid("Has no TestFixtures");
            }
            else
            {
                NamespaceTreeBuilder treeBuilder =
                    new NamespaceTreeBuilder(testAssembly);
                treeBuilder.Add(fixtures);
                testAssembly = treeBuilder.RootSuite;
            }

            testAssembly.ApplyAttributesToTest(assembly);

#if !PORTABLE && !NETSTANDARD1_6
            testAssembly.Properties.Set(PropertyNames.ProcessID, System.Diagnostics.Process.GetCurrentProcess().Id);
            testAssembly.Properties.Set(PropertyNames.AppDomain, AppDomain.CurrentDomain.FriendlyName);
#endif

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

            return(testAssembly);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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;
        }