public IList <UnitTestTask> GetTaskSequence(UnitTestElement element, IList <UnitTestElement> explicitElements)
        {
            if (element is ContextSpecificationElement)
            {
                var contextSpecification = element as ContextSpecificationElement;
                var context = contextSpecification.Context;

                return(new List <UnitTestTask>
                {
                    _taskFactory.CreateAssemblyLoadTask(context),
                    _taskFactory.CreateContextTask(context, explicitElements.Contains(context)),
                    _taskFactory.CreateContextSpecificationTask(context,
                                                                contextSpecification,
                                                                explicitElements.Contains(contextSpecification))
                });
            }

            if (element is BehaviorElement)
            {
                var behavior = element as BehaviorElement;
                var context  = behavior.Context;

                return(new List <UnitTestTask>
                {
                    _taskFactory.CreateAssemblyLoadTask(context),
                    _taskFactory.CreateContextTask(context, explicitElements.Contains(context)),
                    _taskFactory.CreateBehaviorTask(context, behavior, explicitElements.Contains(behavior))
                });
            }

            if (element is BehaviorSpecificationElement)
            {
                var behaviorSpecification = element as BehaviorSpecificationElement;
                var behavior = behaviorSpecification.Behavior;
                var context  = behavior.Context;

                return(new List <UnitTestTask>
                {
                    _taskFactory.CreateAssemblyLoadTask(context),
                    _taskFactory.CreateContextTask(context, explicitElements.Contains(context)),
                    _taskFactory.CreateBehaviorTask(context,
                                                    behavior,
                                                    explicitElements.Contains(behavior)),
                    _taskFactory.CreateBehaviorSpecificationTask(context,
                                                                 behaviorSpecification,
                                                                 explicitElements.Contains(behaviorSpecification))
                });
            }

            if (element is ContextElement)
            {
                return(EmptyArray <UnitTestTask> .Instance);
            }

            throw new ArgumentException(String.Format("Element is not a Machine.Specifications element: '{0}'", element));
        }
示例#2
0
        public IList <UnitTestTask> GetTaskSequence(IList <IUnitTestElement> explicitElements)
#endif
        {
            if (this is ContextSpecificationElement)
            {
                var contextSpecification = this as ContextSpecificationElement;
                var context = contextSpecification.Context;

                return(new List <UnitTestTask>
                {
#if !RESHARPER_8
                    _taskFactory.CreateAssemblyLoadTask(context),
#endif
                    _taskFactory.CreateRunAssemblyTask(context),
                    _taskFactory.CreateContextTask(context),
                    _taskFactory.CreateContextSpecificationTask(context, contextSpecification)
                });
            }

            if (this is BehaviorSpecificationElement)
            {
                var behaviorSpecification = this as BehaviorSpecificationElement;
                var behavior = behaviorSpecification.Behavior;
                var context  = behavior.Context;

                return(new List <UnitTestTask>
                {
#if !RESHARPER_8
                    _taskFactory.CreateAssemblyLoadTask(context),
#endif
                    _taskFactory.CreateRunAssemblyTask(context),
                    _taskFactory.CreateContextTask(context),
                    _taskFactory.CreateBehaviorSpecificationTask(context, behaviorSpecification)
                });
            }

            if (this is ContextElement || this is BehaviorElement)
            {
                return(EmptyArray <UnitTestTask> .Instance);
            }

            throw new ArgumentException(String.Format("Element is not a Machine.Specifications element: '{0}'", this));
        }