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)); }