private static WorkflowDefinition Given_a_workflow_with_three_serial_empty_activities() { var workflow = new WorkflowDefinition(); workflow.Activities = new List <IWorkflowActivityBase> { new MockActivity { Id = "1", DefaultInput = "Hello" }, new MockActivity { Id = "2", Routes = { WorkflowRoute.Create <MyOutput, MyInput>("1", a => a.Output, a => a.Input) } }, new MockActivity { Id = "3" }, }; workflow.StartActivity = workflow.Activities.First(); workflow.Transitions = new List <WorkflowTransition> { new WorkflowTransition { From = "1", To = "2" }, new WorkflowTransition { From = "2", To = "3" }, }; return(workflow); }
/// <exception cref="WorkflowException">A workflow validation exception occurred. </exception> private void ValidateRoute(IWorkflowActivityBase inputActivity, WorkflowRoute route) { var outputActivity = GetActivityById(route.OutputActivityId); var outputProperty = outputActivity.OutputType.GetRuntimeProperty(route.OutputProperty); if (outputProperty == null) throw new WorkflowException("The output property of the route could not be found on the output data type. "); var inputProperty = inputActivity.InputType.GetRuntimeProperty(route.InputProperty); if (inputProperty == null) throw new WorkflowException("The input property of the route could not be found on the input data type. "); if (outputProperty.PropertyType != inputProperty.PropertyType) throw new WorkflowException("The input property and output property types of a route do not match. "); }