public void ConditionExpressionDivideByZero() { Variable <int> counter1 = VariableHelper.CreateInitialized <int>("counter1", 0); Variable <int> counter2 = VariableHelper.CreateInitialized <int>("counter2", 2); TestFlowchart flowchart = new TestFlowchart("Flowchart") { Variables = { counter1, counter2 }, ExpectedOutcome = Outcome.UncaughtException(typeof(DivideByZeroException)) }; flowchart.ExpectedOutcome.IsOverrideable = true; TestAssign <int> assign = new TestAssign <int>("Assign") { ValueExpression = ((env) => (counter1.Get(env) + 1)), ToExpression = ((env) => counter2.Get(env)) }; TestFlowConditional flowDecision = new TestFlowConditional(HintTrueFalse.Exception) { ConditionExpression = ((env) => counter1.Get(env) / (counter2.Get(env) - 1) >= 0), }; flowchart.AddLink(new TestWriteLine("Start", "Flowchart Started"), assign); flowchart.AddConditionalLink(assign, flowDecision, assign, (TestActivity)null); TestRuntime.RunAndValidateAbortedException(flowchart, typeof(DivideByZeroException), null); }
public void FlowchartInProceduralWhile() { TestSequence s = new TestSequence("seq1"); Variable <int> counter = VariableHelper.CreateInitialized <int>("counter", 0); s.Variables.Add(counter); TestWhile w = new TestWhile("While1"); s.Activities.Add(w); TestFlowchart f = new TestFlowchart("Flow1"); TestAssign <int> assign = new TestAssign <int>("Assign1"); assign.ValueExpression = (env => ((int)counter.Get(env)) + 1); assign.ToVariable = counter; w.ConditionExpression = (env => counter.Get(env) < 5); w.HintIterationCount = 5; f.AddStartLink(assign); w.Body = f; TestRuntime.RunAndValidateWorkflow(s); }
public void NestedFlowchartInLoop() { TestFlowchart parentFlowchart = new TestFlowchart("ParentFlowchart"); TestFlowchart childFlowchart = new TestFlowchart("ChildFlowchart"); Variable <int> counter = VariableHelper.CreateInitialized <int>("counter", 0); parentFlowchart.Variables.Add(counter); TestAssign <int> assign = new TestAssign <int>("Assign1"); assign.ValueExpression = (env => ((int)counter.Get(env)) + 1); assign.ToVariable = counter; List <HintTrueFalse> hints = new List <HintTrueFalse>(); for (int i = 0; i < 5; i++) { hints.Add(HintTrueFalse.True); } hints.Add(HintTrueFalse.False); TestFlowConditional flowDecision = new TestFlowConditional(hints.ToArray()); flowDecision.ConditionExpression = (env => counter.Get(env) <= 5); parentFlowchart.AddLink(new TestWriteLine("Start", "Parent started"), childFlowchart); parentFlowchart.AddConditionalLink(childFlowchart, flowDecision, childFlowchart, new TestWriteLine("End", "Parent ended")); childFlowchart.AddStartLink(assign); TestRuntime.RunAndValidateWorkflow(parentFlowchart); }
public void CasesWithAllKeysCustomType() { TestFlowchart flowchart = new TestFlowchart(); Variable <object> expressionVariable = new Variable <object>("expression", context => new SwitchExpressionClass(1)); flowchart.Variables.Add(expressionVariable); Dictionary <object, TestActivity> cases = new Dictionary <object, TestActivity>(); cases.Add(new SwitchExpressionClass(1), new TestWriteLine("ONE", "ONE")); cases.Add(new SwitchExpressionClass(2), new TestWriteLine("Two", "Two")); cases.Add(new SwitchExpressionClass(3), new TestWriteLine("Three", "Three")); List <int> hints = new List <int> { 0 }; flowchart.AddSwitchLink(new TestWriteLine("Start", "Flowchart started"), cases, hints, expressionVariable, new TestWriteLine("Default", "I am not gonna execute")); TestRuntime.RunAndValidateWorkflow(flowchart); }
public void FlowStepAndFlowSwitchNotConnected() { TestFlowchart flowchart1 = new TestFlowchart("flowChart1"); TestWriteLine start1 = new TestWriteLine("Start", "Executing Start"); TestWriteLine w1 = new TestWriteLine("W1", "Executing W1"); TestWriteLine w2 = new TestWriteLine("W2", "Executing W2"); TestWriteLine w3 = new TestWriteLine("W3", "Executing W3"); TestWriteLine wDefault = new TestWriteLine("wDefault", "Executing wDefault"); TestFlowStep flowStep1 = new TestFlowStep(w1); Dictionary <string, TestActivity> cases = new Dictionary <string, TestActivity>(); cases.Add("One", w2); cases.Add("Two", w3); List <int> hints = new List <int>(); hints.Add(1); TestFlowElement flowSwitch1 = flowchart1.AddSwitchLink <string>(null, cases, hints, "Two", wDefault); flowchart1.Elements.Add(flowStep1); TestRuntime.RunAndValidateWorkflow(flowchart1); }
public void FlowSwitchWithAllCasesHavingSameElement() { TestFlowchart flowchart = new TestFlowchart(); Variable <int> counter = VariableHelper.CreateInitialized <int>("counter", 0); flowchart.Variables.Add(counter); TestIncrement increment = new TestIncrement("Inc", 1); increment.CounterVariable = counter; TestWriteLine writeHello = new TestWriteLine("Hello", "Ola"); Dictionary <object, TestActivity> cases = new Dictionary <object, TestActivity>(); cases.Add(1, writeHello); cases.Add(2, writeHello); cases.Add(3, writeHello); List <int> hints = new List <int>() { 0, 1, 2, -1 }; flowchart.AddLink(new TestWriteLine("Start", "Flowchart Started"), increment); flowchart.AddSwitchLink(increment, cases, hints, e => counter.Get(e)); flowchart.AddLink(writeHello, increment); TestRuntime.RunAndValidateWorkflow(flowchart); }
public void SwitchExpressionOnExistingVariable() { TestFlowchart flowchart = new TestFlowchart(); const string defaultValue = "Two"; Variable <string> stringVar = VariableHelper.CreateInitialized <string>("stringVar", defaultValue); flowchart.Variables.Add(stringVar); Dictionary <object, TestActivity> cases = new Dictionary <object, TestActivity>(); cases.Add("One", new TestWriteLine("One", "One")); cases.Add("Two", new TestWriteLine("Two", "Two")); cases.Add("Three", new TestWriteLine("Three", "Three")); cases.Add("Four", new TestWriteLine("Four", "Four")); cases.Add("Five", new TestWriteLine("Five", "Five")); List <int> hints = new List <int> { 1 }; flowchart.AddSwitchLink(new TestWriteLine("Start", "Flowchart started"), cases, hints, e => stringVar.Get(e), new TestWriteLine("Default", "Default Activity")); TestRuntime.RunAndValidateWorkflow(flowchart); }
public void ThrowFromNode() { TestFlowchart flowchart = new TestFlowchart(); Variable <int> expression = new Variable <int> { Name = "expression", Default = 3 }; flowchart.Variables.Add(expression); TestWriteLine w1 = new TestWriteLine("One", "One wont execute"); TestWriteLine w2 = new TestWriteLine("Two", "Two will execute"); TestThrow <Exception> throwAct = new TestThrow <Exception>(); Dictionary <int, TestActivity> cases = new Dictionary <int, TestActivity>(); cases.Add(1, w1); cases.Add(2, w2); cases.Add(3, throwAct); List <int> hints = new List <int>(); hints.Add(2); flowchart.AddSwitchLink <int>(new TestWriteLine("Start", "Flowchart started"), cases, hints, expression, new TestWriteLine("Default", "Default")); TestRuntime.RunAndValidateAbortedException(flowchart, typeof(Exception), null); }
public void SimpleFlowSwitchWithThreeElements() { TestFlowchart flowchart = new TestFlowchart(); Variable <int> expression = new Variable <int> { Name = "expression", Default = 2 }; flowchart.Variables.Add(expression); TestWriteLine w1 = new TestWriteLine("One", "One wont execute"); TestWriteLine w2 = new TestWriteLine("Two", "Two will execute"); TestWriteLine w3 = new TestWriteLine("Three", "Three wont execute"); Dictionary <int, TestActivity> cases = new Dictionary <int, TestActivity>(); cases.Add(1, w1); cases.Add(2, w2); cases.Add(3, w3); List <int> hints = new List <int>(); hints.Add(1); flowchart.AddSwitchLink <int>(new TestWriteLine("Start", "Flowchart started"), cases, hints, expression, new TestWriteLine("Default", "Default")); TestRuntime.RunAndValidateWorkflow(flowchart); }
public void FlowSwitchExpressionEvaluationNullExecuteDefault() { TestFlowchart flowchart = new TestFlowchart(); Variable <string> expVariable = new Variable <string> { Name = "ExpVar" }; flowchart.Variables.Add(expVariable); Dictionary <string, TestActivity> cases = new Dictionary <string, TestActivity>(); cases.Add("One", new TestWriteLine("Hello1", "Hello1")); cases.Add("Two", new TestWriteLine("Hello2", "Hello2")); cases.Add("Three", new TestWriteLine("Hello3", "Hello3")); cases.Add(string.Empty, new TestWriteLine("Hello4", "Hello4")); List <int> hints = new List <int>() { -1 }; flowchart.AddSwitchLink <string>(new TestWriteLine("Start", "Flowchart started"), cases, hints, e => expVariable.Get(e), new TestWriteLine("Default", "Default Activity")); TestRuntime.RunAndValidateWorkflow(flowchart); }
public void FlowSwitchHavingCaseWithNullKeyEvaluateNull() { TestFlowchart flowchart = new TestFlowchart(); Variable <Complex> complexVar = VariableHelper.CreateInitialized <Complex>("complexVar", (Complex)null); flowchart.Variables.Add(complexVar); Dictionary <Complex, TestActivity> cases = new Dictionary <Complex, TestActivity>(); cases.Add(new Complex(0, 0), new TestWriteLine("One", "One")); cases.Add(new Complex(1, 0), new TestWriteLine("Two", "Two")); cases.Add(new Complex(2, 0), new TestWriteLine("Three", "Three")); List <int> hints = new List <int>() { -1 }; TestFlowSwitch <Complex> flowSwitch = flowchart.AddSwitchLink <Complex>(new TestWriteLine("Start", "Flowchart started"), cases, hints, e => complexVar.Get(e)) as TestFlowSwitch <Complex>; ((FlowSwitch <Complex>)flowSwitch.GetProductElement()).Cases.Add(null, new FlowStep { Action = new BlockingActivity("Blocking") }); using (TestWorkflowRuntime runtime = TestRuntime.CreateTestWorkflowRuntime(flowchart)) { runtime.ExecuteWorkflow(); runtime.WaitForActivityStatusChange("Blocking", TestActivityInstanceState.Executing); runtime.ResumeBookMark("Blocking", null); runtime.WaitForCompletion(false); } }
public void SwitchExpressionOnCustomtype() { TestFlowchart flow = new TestFlowchart(); Complex defaultValue = new Complex(3, 3); Variable <Complex> complexVar = new Variable <Complex>("Complex", context => defaultValue); flow.Variables.Add(complexVar); Dictionary <Complex, TestActivity> cases = new Dictionary <Complex, TestActivity>(); cases.Add(new Complex(1, 3), new TestWriteLine("Hello1", "Hello1")); cases.Add(new Complex(2, 3), new TestWriteLine("Hello2", "Hello2")); cases.Add(defaultValue, new TestWriteLine("Hello3", "Hello3")); cases.Add(new Complex(4, 3), new TestWriteLine("Hello4", "Hello4")); List <int> hints = new List <int> { 2 }; flow.AddSwitchLink <Complex>(new TestWriteLine("Start", "Start"), cases, hints, complexVar, new TestWriteLine("Default", "Default")); TestRuntime.RunAndValidateWorkflow(flow); }
/// <summary> /// Exception thrown from 5 level deep nested flowchart and handled at the top level. /// </summary> //[Fact] public void FaultFromFiveLevelDeepNestedFlowchart_Handled() { TestFlowchart parent = new TestFlowchart(); TestFlowchart child1 = new TestFlowchart(); TestFlowchart child2 = new TestFlowchart(); TestFlowchart child3 = new TestFlowchart(); TestFlowchart child4 = new TestFlowchart(); child4.AddStartLink(new TestThrow <WorkflowApplicationAbortedException>() { ExpectedOutcome = Outcome.CaughtException() }); child1.AddStartLink(child2); child2.AddStartLink(child3); child3.AddStartLink(child4); TestTryCatch tryCatchFinally = new TestTryCatch(); tryCatchFinally.Try = child1; tryCatchFinally.Catches.Add(new TestCatch <WorkflowApplicationAbortedException>()); parent.AddStartLink(tryCatchFinally); TestRuntime.RunAndValidateWorkflow(parent); }
public void FaultWhileExecutingInLoop() { TestFlowchart flowchart = new TestFlowchart(); Variable <int> counter = VariableHelper.CreateInitialized <int>(-3); counter.Name = "counter"; flowchart.Variables.Add(counter); List <HintTrueFalse> hints = new List <HintTrueFalse> { HintTrueFalse.True, HintTrueFalse.True, HintTrueFalse.Exception }; TestFlowConditional conditional = new TestFlowConditional(hints.ToArray()) { ConditionExpression = env => (counter.Get(env) - 1) / counter.Get(env) > 0 }; TestIncrement decByOne = new TestIncrement { CounterVariable = counter, IncrementCount = 1 }; flowchart.AddLink(new TestWriteLine("Start", "Start"), decByOne); flowchart.AddConditionalLink(decByOne, conditional, decByOne, null); TestRuntime.RunAndValidateAbortedException(flowchart, typeof(DivideByZeroException), null); }
public void Flowchart_Forloop() { TestFlowchart flowchart = new TestFlowchart("Flow1"); Variable <int> counter = VariableHelper.CreateInitialized <int>("counter", 0); flowchart.Variables.Add(counter); TestWriteLine writeLine1 = new TestWriteLine("hello1", "Hello1"); TestWriteLine writeLine2 = new TestWriteLine("hello2", "Hello2"); TestAssign <int> assign = new TestAssign <int>("Assign1"); assign.ValueExpression = ((env) => ((int)counter.Get(env)) + 1); assign.ToVariable = counter; List <HintTrueFalse> hints = new List <HintTrueFalse>(); for (int i = 0; i < 49; i++) { hints.Add(HintTrueFalse.True); } hints.Add(HintTrueFalse.False); TestFlowConditional flowDecision = new TestFlowConditional(hints.ToArray()); flowDecision.ConditionExpression = (context => counter.Get(context) < 50); flowchart.AddLink(writeLine1, assign); flowchart.AddConditionalLink(assign, flowDecision, assign, writeLine2); TestRuntime.RunAndValidateWorkflow(flowchart); }
public void ConnectFromFlowconditionalBothTrueAndFalseToSameFlowconditional() { TestFlowchart flowchart = new TestFlowchart(); Variable <int> counter = VariableHelper.CreateInitialized <int>("counter", 0); flowchart.Variables.Add(counter); TestWriteLine w1 = new TestWriteLine("w1", "w1"); TestWriteLine w2 = new TestWriteLine("w2", "w2"); TestAssign <int> assign = new TestAssign <int>("assign") { ValueExpression = (e => counter.Get(e) + 1), ToVariable = counter }; TestFlowConditional conditional1 = new TestFlowConditional(HintTrueFalse.False) { ConditionExpression = (e => counter.Get(e) == 5) }; TestFlowConditional conditional2 = new TestFlowConditional(HintTrueFalse.False) { ConditionExpression = (e => counter.Get(e) == 5) }; flowchart.AddLink(w1, assign); flowchart.AddConditionalLink(assign, conditional1); flowchart.AddConditionalLink(null, conditional2, assign, w2); flowchart.AddConditionalLink(null, conditional1, conditional2, conditional2); TestRuntime.RunAndValidateWorkflow(flowchart); }
public void FlowSwitchInLoopDefaultEvaluation() { TestFlowchart flowchart = new TestFlowchart(); Variable <int> counter = VariableHelper.CreateInitialized <int>(0); counter.Name = "counter"; flowchart.Variables.Add(counter); Dictionary <object, TestActivity> cases = new Dictionary <object, TestActivity>(); cases.Add(10, new TestWriteLine("Ten", "Ten")); cases.Add(11, new TestWriteLine("Eleven", "Eleven")); cases.Add(12, new TestWriteLine("Twelve", "Twelve")); cases.Add(13, new TestWriteLine("Thirteen", "Thirteen")); List <int> hints = new List <int>(); for (int i = 0; i < 10; i++) { hints.Add(-1); } hints.Add(0); TestIncrement incByOne = new TestIncrement { IncrementCount = 1, CounterVariable = counter }; TestFlowSwitch <object> flowSwitch = flowchart.AddSwitchLink <object>(new TestWriteLine("Start", "Flowchart started"), cases, hints, e => counter.Get(e), incByOne) as TestFlowSwitch <object>; flowchart.AddLink(incByOne, flowSwitch); TestRuntime.RunAndValidateWorkflow(flowchart); }
public void FlowchartWithoutExplicitOrImplicitStartEvent() { TestFlowchart flowchart = new TestFlowchart(); Variable <int> counter = VariableHelper.CreateInitialized <int>("counter", 0); flowchart.Variables.Add(counter); TestAssign <int> assign = new TestAssign <int>("assign") { ValueExpression = (e => counter.Get(e) + 1), ToVariable = counter }; List <HintTrueFalse> hintsList = new List <HintTrueFalse>(); hintsList.Add(HintTrueFalse.True); hintsList.Add(HintTrueFalse.False); TestFlowConditional conditional = new TestFlowConditional(hintsList.ToArray()) { ConditionExpression = (e => counter.Get(e) == 1) }; flowchart.AddConditionalLink(assign, conditional, assign, (TestActivity)null); TestRuntime.RunAndValidateWorkflow(flowchart); }
public void FlowSwitchDefaultExecutionWithMultipleCases() { TestFlowchart flowchart = new TestFlowchart(); Variable <object> expressionVariable = new Variable <object>("expression", context => "Four"); flowchart.Variables.Add(expressionVariable); Dictionary <object, TestActivity> cases = new Dictionary <object, TestActivity>(); cases.Add(1, new TestWriteLine("ONE", "ONE")); cases.Add(2, new TestWriteLine("Two", "Two")); cases.Add(3, new TestWriteLine("Three", "Three")); List <int> hints = new List <int> { -1 }; flowchart.AddSwitchLink(new TestWriteLine("Start", "Flowchart started"), cases, hints, expressionVariable, new TestWriteLine("Default", "I am gonna execute")); TestRuntime.RunAndValidateWorkflow(flowchart); }
public void FlowDecisionConnectedToFlowSwitch() { TestFlowchart flowchart = new TestFlowchart("Flow1"); Variable <int> counter = VariableHelper.CreateInitialized <int>("counter", 3); flowchart.Variables.Add(counter); TestWriteLine writeLine1 = new TestWriteLine("hello1", "Hello1"); TestWriteLine writeLine2 = new TestWriteLine("hello2", "Hello2"); TestWriteLine w1 = new TestWriteLine("WriteLine1", "Executing WriteLine1"); TestWriteLine w2 = new TestWriteLine("WriteLine2", "Executing WriteLine2"); TestWriteLine w3 = new TestWriteLine("WriteLine3", "Executing WriteLine3"); TestWriteLine wDefault = new TestWriteLine("wDefault", "Executing wDefault"); TestFlowConditional flowDecision = new TestFlowConditional(HintTrueFalse.False) { ConditionExpression = (context => counter.Get(context) > 4) }; Dictionary <string, TestActivity> cases = new Dictionary <string, TestActivity>(); cases.Add("One", w1); cases.Add("Two", w2); cases.Add("Three", w3); List <int> hints = new List <int>(); hints.Add(1); TestFlowElement switchElement = flowchart.AddSwitchLink <string>(null, cases, hints, "Two", wDefault); flowchart.AddConditionalLink(writeLine1, flowDecision, writeLine2, switchElement); TestRuntime.RunAndValidateWorkflow(flowchart); }
public void ThrowWhileEvaluatingExpression() { TestFlowchart flowchart = new TestFlowchart(); TestWriteLine writeHello = new TestWriteLine("Hello", "Hello"); TestWriteLine writeStart = new TestWriteLine("Start", "Start"); TestExpressionEvaluatorWithBody <string> expressionActivity = new TestExpressionEvaluatorWithBody <string>("One") { Body = new TestThrow <ArgumentOutOfRangeException>() }; Dictionary <string, TestActivity> cases = new Dictionary <string, TestActivity>(); cases.Add("One", new TestWriteLine("One", "One will not execute")); cases.Add("Two", new TestWriteLine("Two", "Two will not execute")); List <int> hints = new List <int>() { -1 }; flowchart.AddStartLink(writeStart); flowchart.AddSwitchLink <string>(writeStart, cases, hints, expressionActivity, new TestWriteLine("Default", "Will not execute")); TestRuntime.RunAndValidateAbortedException(flowchart, typeof(ArgumentOutOfRangeException), null); }
public void Flowchart_DoWhile() { TestFlowchart flowchart = new TestFlowchart(); Variable <int> counter = VariableHelper.CreateInitialized <int>(0); counter.Name = "counter"; flowchart.Variables.Add(counter); List <HintTrueFalse> hintsList = new List <HintTrueFalse>(); for (int i = 0; i < 9; i++) { hintsList.Add(HintTrueFalse.True); } hintsList.Add(HintTrueFalse.False); TestFlowConditional conditional = new TestFlowConditional(hintsList.ToArray()) { ConditionExpression = env => counter.Get(env) < 10 }; TestWriteLine start = new TestWriteLine("Start", "Flowchart Started"); TestIncrement incrementByOne = new TestIncrement() { CounterVariable = counter, IncrementCount = 1 }; flowchart.AddLink(start, incrementByOne); flowchart.AddConditionalLink(incrementByOne, conditional, incrementByOne, new TestWriteLine("Final", "End")); TestRuntime.RunAndValidateWorkflow(flowchart); }
public void FlowDecisionAndFlowSwitchNotConnected() { TestFlowchart flowchart1 = new TestFlowchart("flowChart1"); TestWriteLine start1 = new TestWriteLine("Start", "Executing Start"); TestWriteLine w1 = new TestWriteLine("W1", "Executing W1"); TestWriteLine w2 = new TestWriteLine("W2", "Executing W2"); TestWriteLine w3 = new TestWriteLine("W3", "Executing W3"); TestWriteLine wDefault = new TestWriteLine("wDefault", "Executing wDefault"); Dictionary <string, TestActivity> cases = new Dictionary <string, TestActivity>(); cases.Add("One", w1); cases.Add("Two", w2); List <int> hints = new List <int>(); hints.Add(1); flowchart1.AddSwitchLink <string>(null, cases, hints, "Two", wDefault); TestWriteLine w2True = new TestWriteLine("True", "True will execute"); TestWriteLine w2False = new TestWriteLine("False", "False wont execute"); Variable <int> margin = VariableHelper.CreateInitialized <int>("Margin", 10); flowchart1.Variables.Add(margin); TestFlowConditional flowDecision = new TestFlowConditional(HintTrueFalse.True); flowDecision.ConditionExpression = (context => margin.Get(context) > 0); TestFlowElement tCond = flowchart1.AddConditionalLink(null, flowDecision, w2True, w2False); flowchart1.Elements.Add(tCond); TestRuntime.RunAndValidateWorkflow(flowchart1); }
/// <summary> /// Setup a t/c/f statement. /// </summary> /// <param name="tryBody">Try activity.</param> /// <param name="tc">Array of Catches.</param> /// <param name="finallyBody">Finally activity.</param> /// <param name="type">Type of workflow to create.</param> /// <param name="otherActivities">Flag indicating whether extra activities should be added.</param> public static TestActivity CreateTryCatchFinally(TestActivity tryBody, TestCatch[] tc, TestActivity finallyBody, WFType type, bool otherActivities) { // create the try/catch/finally TestTryCatch tcf = new TestTryCatch("TestTcf"); if (tryBody != null) { tcf.Try = tryBody; } if (tc != null) { foreach (TestCatch testCatch in tc) { tcf.Catches.Add(testCatch); } } if (finallyBody != null) { tcf.Finally = finallyBody; } // extra activities to add around activity if otherActivities is true TestWriteLine before = new TestWriteLine("BeforeTry", "BeforeTry"); TestWriteLine after = new TestWriteLine("AfterTry", "AfterTry"); // sequence if (type == WFType.SEQ) { TestSequence seq = new TestSequence("SequenceOfActivitiesContainingTCF"); if (otherActivities) { seq.Activities.Add(before); } seq.Activities.Add(tcf); if (otherActivities) { seq.Activities.Add(after); } return(seq); } // otherwise do flowchart else // type == wfType.FLOW { TestFlowchart flowchart = new TestFlowchart("FlowchartContainingTCF"); if (otherActivities) { flowchart.AddStartLink(before); flowchart.AddLink(before, tcf); flowchart.AddLink(tcf, after); } else { flowchart.AddStartLink(tcf); } return(flowchart); } }
public void ExecuteFlowchartWithSingleActivityNotMarkedStart() { TestFlowchart flowchart = new TestFlowchart { Elements = { new TestWriteLine("Only One", "OnlyOne") } }; TestRuntime.RunAndValidateWorkflow(flowchart); }
public void FlowStepAsStartNode() { TestFlowchart flowchart = new TestFlowchart(); flowchart.AddStartLink(new TestWriteLine("Begin", "End")); TestRuntime.RunAndValidateWorkflow(flowchart); }
public void FlowStepWithNullNext() { TestFlowchart flowchart1 = new TestFlowchart("flowChart1"); TestWriteLine w1 = new TestWriteLine("writeLine1", "Executing writeLine1"); flowchart1.AddStartLink(w1); TestRuntime.RunAndValidateWorkflow(flowchart1); }
public void FlowStepConnectedToFlowStep() { TestFlowchart flowchart = new TestFlowchart(); flowchart.AddLink(new TestWriteLine("Start", "Start"), new TestWriteLine("End", "End")); TestRuntime.RunAndValidateWorkflow(flowchart); }
public void AddWorkflowElementToElementsCollection() { TestFlowchart flowchart = new TestFlowchart(); flowchart.Elements.Add(new TestWriteLine("StartAndEnd", "StartAndEnd")); TestRuntime.RunAndValidateWorkflow(flowchart); }
public void AddFlowchartToItself() { TestFlowchart flow = new TestFlowchart(); flow.AddLink(new TestWriteLine("w1", "w1"), flow); TestRuntime.ValidateInstantiationException(flow, string.Format(ErrorStrings.ActivityCannotReferenceItself, flow.DisplayName)); }