Esempio n. 1
0
        public IList <UnitTestTask> GetTaskSequence(ICollection <IUnitTestElement> explicitElements, IUnitTestLaunch launch)
#endif
        {
            // Add the run task.  Must always be first.
            var tasks = new List <UnitTestTask> {
                new UnitTestTask(null, FacadeTaskFactory.CreateRootTask())
            };

            // Add the test case branch.
            AddTestTasksFromRootToLeaf(tasks, this);

            // Now that we're done with the critical parts of the task tree, we can add other
            // arbitrary elements.  We don't care about the structure of the task tree beyond this depth.

            // Add the assembly location.
            tasks.Add(new UnitTestTask(null, new AssemblyLoadTask(GetAssemblyLocation())));
            tasks.Add(new UnitTestTask(null, FacadeTaskFactory.CreateAssemblyTaskFrom(this)));

            if (explicitElements.Count() != 0)
            {
                // Add explicit element markers.
                foreach (GallioTestElement explicitElement in explicitElements)
                {
                    tasks.Add(new UnitTestTask(null, FacadeTaskFactory.CreateExplicitTestTaskFrom(explicitElement)));
                }
            }
            else
            {
                // No explicit elements but we must have at least one to filter by, so we consider
                // the top test explicitly selected.
                tasks.Add(new UnitTestTask(null, FacadeTaskFactory.CreateExplicitTestTaskFrom(this)));
            }

            return(tasks);
        }
        public override IList <UnitTestTask> GetTaskSequence(IEnumerable <IUnitTestElement> explicitElements)
        {
            IList <UnitTestTask> testTasks;

            if (Parent != null)
            {
                testTasks = Parent.GetTaskSequence(explicitElements);
                testTasks.Add(new UnitTestTask(this, FacadeTaskFactory.CreateTestTaskFrom(this)));
            }
            else
            {
                testTasks = new List <UnitTestTask>();
                // Add the run task.  Must always be first.
                testTasks.Add(new UnitTestTask(null, FacadeTaskFactory.CreateRootTask()));
                testTasks.Add(new UnitTestTask(null, new AssemblyLoadTask(GetAssemblyLocation())));

                if (explicitElements != null && explicitElements.Count() != 0)
                {
                    // Add explicit element markers.
                    foreach (GallioTestElement explicitElement in explicitElements)
                    {
                        testTasks.Add(new UnitTestTask(null, FacadeTaskFactory.CreateExplicitTestTaskFrom(explicitElement)));
                    }
                }
                else
                {
                    // No explicit elements but we must have at least one to filter by, so we consider
                    // the top test explicitly selected.
                    testTasks.Add(new UnitTestTask(null, FacadeTaskFactory.CreateExplicitTestTaskFrom(this)));
                }
            }
            return(testTasks);
        }
Esempio n. 3
0
            /// <summary>
            /// Gets task information for <see cref="T:JetBrains.ReSharper.TaskRunnerFramework.RemoteTaskRunner" /> from element.
            /// </summary>
            public IList <UnitTestTask> GetTaskSequence(UnitTestElement element, IList <UnitTestElement> explicitElements)
            {
                if (element == null)
                {
                    throw new ArgumentNullException("element");
                }
                if (explicitElements == null)
                {
                    throw new ArgumentNullException("explicitElements");
                }

                GallioTestElement   topElement = (GallioTestElement)element;
                List <UnitTestTask> tasks      = new List <UnitTestTask>();

                // Add the run task.  Must always be first.
                tasks.Add(new UnitTestTask(null, FacadeTaskFactory.CreateRootTask()));

                // Add the test case branch.
                AddTestTasksFromRootToLeaf(tasks, topElement);

                // Now that we're done with the critical parts of the task tree, we can add other
                // arbitrary elements.  We don't care about the structure of the task tree beyond this depth.

                // Add the assembly location.
                tasks.Add(new UnitTestTask(null, FacadeTaskFactory.CreateAssemblyTaskFrom(topElement)));

                if (explicitElements.Count != 0)
                {
                    // Add explicit element markers.
                    foreach (GallioTestElement explicitElement in explicitElements)
                    {
                        tasks.Add(new UnitTestTask(null, FacadeTaskFactory.CreateExplicitTestTaskFrom(explicitElement)));
                    }
                }
                else
                {
                    // No explicit elements but we must have at least one to filter by, so we consider
                    // the top test explicitly selected.
                    tasks.Add(new UnitTestTask(null, FacadeTaskFactory.CreateExplicitTestTaskFrom(topElement)));
                }

                return(tasks);
            }