Esempio n. 1
0
        public void CanRegisterActionAsFilter()
        {
            var parameters = new Dictionary<string, object>();
            var actionWrapper = new ActionWrapperFilter(this.ActionFunction);
            var step = new Step("13", "12", "Manager Approve", "Request Promotion",
                                    "Approve", DateTime.Now, "Spock", "Spock;Kirk",
                                    parameters);
            step.CanProcess = true;

            var pipeline = new Pipeline<Step>();
            pipeline.Register(actionWrapper)
                    .Execute(step);

            Assert.AreEqual("ActionFunction fired", step.Parameters["ActionResults"].ToString());
        }
Esempio n. 2
0
        /// <summary>
        /// Set up the pipeline based on a list of pre and post process filters that
        /// execute before or after the workflow processor's ExecuteTriggerFilter       
        /// </summary>
        /// <param name="preProcessFilterNames">Filter names to execute prior to ExecuteTriggerFilter as string</param>
        /// <param name="postProcessFilterNames">Filter names to execute after to ExecuteTriggerFilter as string</param>
        /// <returns>WorkflowProcessor for fluent interface</returns>
        public WorkflowProcessor ConfigurePipeline(string preProcessFilterNames, string postProcessFilterNames)
        {
            Enforce.That(string.IsNullOrEmpty(preProcessFilterNames) == false,
                            "WorkflowProcessor.Configure - preProcessFilterNames can not be null");

            Enforce.That(string.IsNullOrEmpty(postProcessFilterNames) == false,
                            "WorkflowProcessor.Configure - postProcessFilterNames can not be null");

            var actionWrapper = new ActionWrapperFilter(this.ExecuteTriggerFilter);

            this.pipeline.RegisterFromList(preProcessFilterNames, this.filterRegistry)
                            .Register(actionWrapper)
                            .RegisterFromList(postProcessFilterNames, this.filterRegistry);

            return this;
        }