private void Setup(bool withCanExecutePredicate = false, bool canExecuteResult = false)
        {
            Func <SourceObject, bool> canExecuteFunction = null;

            if (withCanExecutePredicate)
            {
                canExecuteFunction = (so) => {
                    LastCanExecuteInvocation = new DelegateInvocation {
                        SourceObject = so
                    };
                    return(canExecuteResult);
                };
            }

            Action <SourceObject> executeAction = (so) => {
                LastExecuteInvocation = new DelegateInvocation {
                    SourceObject = so
                };
            };

            Behavior = new DelegateCommandExecutorBehavior <SourceObject>(executeAction, canExecuteFunction);
            Next     = new NextBehavior();

            Context = PropertyStub
                      .WithBehaviors(Behavior, Next)
                      .GetContext();
        }
Exemple #2
0
 protected internal virtual void invokeVarMappingDelegation(DelegateInvocation delegation)
 {
     try
     {
         Context.ProcessEngineConfiguration.DelegateInterceptor.handleInvocation(delegation);
     }
     catch (Exception ex)
     {
         throw new ProcessEngineException(ex);
     }
 }
 private static void GenerateHandlerClass(
     StringBuilder builder,
     DelegateInvocation invocation,
     (string Type, string Name)[] methodParameters,