/// <summary> /// Runs configured and permitted tasks in the workflow instance /// </summary> /// <returns>Task execution instance of <see cref="TaskRunReport{TStatus}"/> containing executes task types</returns> public TaskRunReport <TTask> Do() { _workflow .ThrowIfNoTasksAreAllowed(); var tasksBatch = this.Where(task => _workflow .Allows(task.Key)) .Select(work => work) .ToList(); tasksBatch .Select(doTask => doTask.Value) .ToList() .ForEach(doTask => doTask()); var tasksDone = tasksBatch .Select(taskType => taskType.Key) .ToList(); return (new TaskRunReport <TTask>(tasksDone)); }