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);
        }
Beispiel #2
0
        private void AddTestTasksFromRootToLeaf(ICollection <UnitTestTask> tasks, GallioTestElement element)
        {
            var parentElement = element.Parent as GallioTestElement;

            if (parentElement != null)
            {
                AddTestTasksFromRootToLeaf(tasks, parentElement);
            }

            tasks.Add(new UnitTestTask(element, FacadeTaskFactory.CreateTestTaskFrom(element)));
        }