/// <summary>
        /// Validates the specified workplan.
        /// </summary>
        /// <param name="workplan">The workplan.</param>
        /// <exception cref="ValidationException">
        /// Error during 'DeadEnd'-Validation
        /// or
        /// Error during 'InfiniteLoop'-Validation
        /// or
        /// Error during 'LoneWolf'-Validation
        /// or
        /// Error during 'LuckStreak'-Validation
        /// </exception>
        public static void Validate(this IWorkplan workplan)
        {
            const ValidationAspect aspects = ValidationAspect.DeadEnd | ValidationAspect.InfiniteLoop | ValidationAspect.LoneWolf | ValidationAspect.LuckyStreak;
            var result = Workflow.Validate(workplan, aspects);

            if (result.Success)
            {
                return;
            }

            foreach (var error in result.Errors)
            {
                throw new ValidationException(error.Print(workplan));
            }
        }
        /// <summary>
        /// Validate the workplan under different aspects. Aspects can be combined using '|' operator.
        /// </summary>
        /// <param name="workplan">Workplan to validate</param>
        /// <param name="aspects">Enum flag aspects to validate</param>
        /// <returns><remarks>True</remarks> if validation succeeded. Otherwise <remarks>false</remarks>.</returns>
        public static ValidationResult Validate(IWorkplan workplan, ValidationAspect aspects)
        {
            var valid  = true;
            var errors = new List <ValidationError>();

            foreach (var validator in Validators)
            {
                if (aspects.HasFlag(validator.TargetAspect))
                {
                    valid &= validator.Validate(workplan, errors);
                }
            }

            return(new ValidationResult
            {
                Success = valid,
                Errors = errors.ToArray()
            });
        }
 /// <summary>
 /// Validate the workplan under different aspects. Aspects can be combined using '|' operator.
 /// </summary>
 /// <param name="workplan">Workplan to validate</param>
 /// <param name="aspects">Enum flag aspects to validate</param>
 /// <returns><remarks>True</remarks> if validation succeeded. Otherwise <remarks>false</remarks>.</returns>
 public static ValidationResult Validate(IWorkplan workplan, ValidationAspect aspects)
 {
     return(WorkflowValidation.Validate(workplan, aspects));
 }