Example #1
0
        public void Load(IRunPipeFilter filter)
        {
            if (filter == null)
            {
                throw new ArgumentNullException("filter");
            }

            this.starters.Clear();
            try
            {
                RunInvokerTree tree = new RunInvokerTree(this);

                foreach (RunPipe pipe in tree.AllTestPipes())
                {
                    if (!filter.Filter(pipe))
                    {
                        continue;
                    }

                    RunPipeStarter starter = new RunPipeStarter(pipe);
                    this.Starters.Add(starter);
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Error while create the invoker tree", ex);
            }
        }
Example #2
0
 protected virtual void SetFilters()
 {
     if (this.typeFilter != null)
     {
         this.TestEngine.Explorer.TypeFilter = this.typeFilter;
     }
     if (this.filter != null)
     {
         this.TestEngine.Explorer.Filter = this.filter;
     }
     if (this.RunPipeFilter != null)
     {
         this.TestEngine.FixtureRunner.RunPipeFilter = this.RunPipeFilter;
     }
 }
Example #3
0
        public void Load(IRunPipeFilter filter)
        {
            if (filter == null)
                throw new ArgumentNullException("filter");

            this.starters.Clear();
            try
            {
                RunInvokerTree tree = new RunInvokerTree(this);

                foreach (RunPipe pipe in tree.AllTestPipes())
                {
                    if (!filter.Filter(pipe))
                        continue;
    
                    RunPipeStarter starter = new RunPipeStarter(pipe);
                    this.Starters.Add(starter);
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException("Error while create the invoker tree", ex);
            }
        }
        public static TestDomainDependencyGraph BuildGraph(
            string[] testAssemblies,
            string[] assemblyPaths,
            IFixtureFilter fixtureFilter,
            IRunPipeFilter runPipeFilter,
            bool verbose
            )
        {
            // MLS 12/21/05 - adding verbose parameter to fix MBUNIT-28 (verbose command line option not working).
            // IDEA: A more flexible solution might be to pass in a collection of IRunPipeListeners.

            if (testAssemblies == null)
                throw new ArgumentNullException("testAssemblies");
            if (testAssemblies.Length == 0)
                throw new ArgumentException("No assembly to test");
            if (fixtureFilter == null)
                throw new ArgumentNullException("fixtureFilter");
            if (runPipeFilter == null)
                throw new ArgumentNullException("runPipeFilter");

            Hashtable loadedAssemblies = new Hashtable();
            TestDomainDependencyGraph graph = null;
            try
            {
                graph = new TestDomainDependencyGraph();
                graph.verbose = verbose;
                if (assemblyPaths != null)
                    graph.AssemblyPaths.AddRange(assemblyPaths);
                foreach (string testAssembly in testAssemblies)
                {
                    if (loadedAssemblies.Contains(testAssembly))
                        continue;

                    TestDomain domain = new TestDomain(testAssembly);

                    domain.Filter = fixtureFilter;
                    domain.RunPipeFilter = runPipeFilter;
                    graph.AddDomain(domain);
                    loadedAssemblies.Add(testAssembly, null);
                }
                graph.CreateDependencies();

                return graph;
            }
            catch(Exception ex)
            {
                if (graph != null)
                {
                    graph.Dispose();
                    graph = null;
                }
                throw new ApplicationException("Failed loading assemblies", ex);
            }
        }
Example #5
0
 protected virtual void SetFilters()
 {
     if (this.typeFilter != null)
         this.TestEngine.Explorer.TypeFilter = this.typeFilter;
     if (this.filter != null)
         this.TestEngine.Explorer.Filter = this.filter;
     if (this.RunPipeFilter != null)
         this.TestEngine.FixtureRunner.RunPipeFilter = this.RunPipeFilter;
 }
Example #6
0
        public static TestDomainDependencyGraph BuildGraph(
            string[] testAssemblies,
            string[] assemblyPaths,
            IFixtureFilter fixtureFilter,
            IRunPipeFilter runPipeFilter,
            bool verbose
            )
        {
            // MLS 12/21/05 - adding verbose parameter to fix MBUNIT-28 (verbose command line option not working).
            // IDEA: A more flexible solution might be to pass in a collection of IRunPipeListeners.

            if (testAssemblies == null)
            {
                throw new ArgumentNullException("testAssemblies");
            }
            if (testAssemblies.Length == 0)
            {
                throw new ArgumentException("No assembly to test");
            }
            if (fixtureFilter == null)
            {
                throw new ArgumentNullException("fixtureFilter");
            }
            if (runPipeFilter == null)
            {
                throw new ArgumentNullException("runPipeFilter");
            }

            Hashtable loadedAssemblies      = new Hashtable();
            TestDomainDependencyGraph graph = null;

            try
            {
                graph         = new TestDomainDependencyGraph();
                graph.verbose = verbose;
                if (assemblyPaths != null)
                {
                    graph.AssemblyPaths.AddRange(assemblyPaths);
                }
                foreach (string testAssembly in testAssemblies)
                {
                    if (testAssembly.EndsWith(".mbunit"))
                    {
                        MbUnitProject project = MbUnitProject.Load(testAssembly);
                        foreach (string assembly in project.Assemblies)
                        {
                            if (loadedAssemblies.Contains(assembly))
                            {
                                continue;
                            }

                            TestDomain domain = new TestDomain(assembly);
                            domain.Filter        = fixtureFilter;
                            domain.RunPipeFilter = runPipeFilter;
                            graph.AddDomain(domain);
                            loadedAssemblies.Add(assembly, null);
                        }
                    }
                    else
                    {
                        if (loadedAssemblies.Contains(testAssembly))
                        {
                            continue;
                        }

                        TestDomain domain = new TestDomain(testAssembly);
                        domain.Filter        = fixtureFilter;
                        domain.RunPipeFilter = runPipeFilter;
                        graph.AddDomain(domain);
                        loadedAssemblies.Add(testAssembly, null);
                    }
                }
                graph.CreateDependencies();

                return(graph);
            }
            catch (System.Runtime.Remoting.RemotingException remote)
            {
                throw remote;
            }
            catch (Exception ex)
            {
                if (graph != null)
                {
                    graph.Dispose();
                    graph = null;
                }
                throw new ApplicationException("Failed loading assemblies", ex);
            }
        }