public void ComplexScenario() { //TestFlowchart OM makes it difficult to construct such invalid flowchart, hence using product and wrapping it in TestFlowchart TestFlowchart flowchart = new TestFlowchart(); Act.Flowchart prod = flowchart.ProductActivity as Act.Flowchart; FlowStep A = new FlowStep(); FlowSwitch <object> B = new FlowSwitch <object>(); FlowStep C = new FlowStep() { Action = new WriteLine { Text = "Dummy" } }; FlowDecision D = new FlowDecision(); //A->B->C->D, StartNode = B, Nodes = {A, A, A} A.Next = B; B.Default = C; C.Next = D; prod.StartNode = B; prod.Nodes.Add(A); prod.Nodes.Add(A); prod.Nodes.Add(A); List <string> errors = new List <string>(); errors.Add(string.Format(ErrorStrings.FlowSwitchRequiresExpression, prod.DisplayName)); errors.Add(string.Format(ErrorStrings.FlowDecisionRequiresCondition, prod.DisplayName)); Validate(flowchart, errors); }
public void FlowSwitchRequiresExpression() { TestFlowchart flowchart = new TestFlowchart(); Act.Flowchart prod = flowchart.ProductActivity as Act.Flowchart; FlowStep step1; FlowStep step2; FlowSwitch <object> flowSwitch = new FlowSwitch <object> { Cases = { { 2, step2 = new FlowStep { Action = new WriteLine{ Text = "Dummy" } } } }, Default = step1 = new FlowStep { Action = new WriteLine { Text = "Dummy" } } }; prod.StartNode = flowSwitch; prod.Nodes.Add(step1); prod.Nodes.Add(step2); List <string> errors = new List <string>(); errors.Add(string.Format(ErrorStrings.FlowSwitchRequiresExpression, prod.DisplayName)); Validate(flowchart, errors); }
public void FlowchartInitializerSyntax_Sequence() { Test.Common.TestObjects.CustomActivities.WriteLine writeLine1 = new Test.Common.TestObjects.CustomActivities.WriteLine(); writeLine1.Message = new InArgument <string>("Hello1"); Test.Common.TestObjects.CustomActivities.WriteLine writeLine2 = new Test.Common.TestObjects.CustomActivities.WriteLine(); writeLine2.Message = new InArgument <string>("Hello2"); Test.Common.TestObjects.CustomActivities.WriteLine writeLine3 = new Test.Common.TestObjects.CustomActivities.WriteLine(); writeLine3.Message = new InArgument <string>("Hello3"); FlowStep flowStep1 = new FlowStep { Action = writeLine1 }; FlowStep flowStep2 = new FlowStep { Action = writeLine2, Next = flowStep1 }; FlowStep flowStep3 = new FlowStep { Action = writeLine3, Next = flowStep2 }; Microsoft.CoreWf.Statements.Flowchart flowchart = new Microsoft.CoreWf.Statements.Flowchart { Nodes = { flowStep1, flowStep2, flowStep3 }, StartNode = flowStep3 }; AutoResetEvent are = new AutoResetEvent(false); WorkflowApplication application = new WorkflowApplication(flowchart); application.Completed = delegate(WorkflowApplicationCompletedEventArgs e) { are.Set(); }; application.Run(); are.WaitOne(); }
public void FlowDecisionConditionMustBeSet() { TestFlowchart flowchart = new TestFlowchart(); Act.Flowchart prod = flowchart.ProductActivity as Act.Flowchart; FlowStep step; FlowDecision decision = new FlowDecision { True = step = new FlowStep { Action = new WriteLine { Text = "Dummy" } } }; prod.StartNode = decision; prod.Nodes.Add(step); List <string> errors = new List <string>(); errors.Add(string.Format(ErrorStrings.FlowDecisionRequiresCondition, prod.DisplayName)); Validate(flowchart, errors); }