Exemple #1
0
        public ITarget Run(IContext context)
        {
            context.Important(this.Description);

            if (IfFunc != null)
            {
                bool result = IfFunc.Invoke();
                if (!result)
                    return this;
            }
            if (UnlessFunc != null)
            {
                bool result = UnlessFunc.Invoke();
                if (result)
                    return this;
            }

            if (ExecutionAction != null)
            {
                try
                {
                    ExecutionAction.DynamicInvoke(null);
                }
                catch (Exception ex)
                {
                    context.Error(ex);

                    if (ThrowExceptionOnError)
                        throw new TargetExecutionException();
                }
            }

            return this;
        }