Exemple #1
0
        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);
        }
Exemple #2
0
        public void FlowStepWithBothActionAndNextNull()
        {
            TestFlowchart flowchart1 = new TestFlowchart("flowChart1");
            TestFlowStep  flowStep1  = new TestFlowStep();

            flowchart1.Elements.Add(flowStep1);

            TestRuntime.RunAndValidateWorkflow(flowchart1);
        }
Exemple #3
0
        public void TwoNonConnectedFlowSteps()
        {
            TestFlowchart flowchart1 = new TestFlowchart("flowChart1");
            TestFlowStep  flowStep1  = new TestFlowStep(new TestWriteLine("W1", "W1"));
            TestFlowStep  flowStep2  = new TestFlowStep(new TestWriteLine("W2", "W2"));

            flowchart1.Elements.Add(flowStep1);
            flowchart1.Elements.Add(flowStep2);

            TestRuntime.RunAndValidateWorkflow(flowchart1);
        }
Exemple #4
0
        public void AddSameElementTwiceToFlowchartElementsCollection()
        {
            TestFlowchart flowchart = new TestFlowchart();
            TestFlowStep  step      = new TestFlowStep();

            step.ActionActivity = new TestWriteLine("Start", "Dummy Start");

            flowchart.Elements.Add(step);
            flowchart.Elements.Add(step);

            TestRuntime.RunAndValidateWorkflow(flowchart);
        }
Exemple #5
0
        public void AddSameElementToParentAndChild()
        {
            TestFlowchart   flowchart1 = new TestFlowchart("flowChart1");
            TestFlowchart   flowchart2 = new TestFlowchart("flowChart2");
            TestWriteLine   w1         = new TestWriteLine("W1", "Executing W1");
            TestFlowElement fStep      = new TestFlowStep(w1);

            flowchart2.Elements.Add(fStep);

            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, fStep, flowchart2);

            TestRuntime.ValidateInstantiationException(flowchart1, string.Format(ErrorStrings.FlowNodeCannotBeShared, flowchart1.DisplayName, flowchart2.DisplayName));
        }
Exemple #6
0
        public void FlowSwitchConnectedToFlowDecision()
        {
            TestFlowchart flowchart = new TestFlowchart();

            TestWriteLine wStart   = new TestWriteLine("Start", "Flowchart started");
            TestWriteLine wDefault = new TestWriteLine("Default", "Default");
            TestWriteLine w1       = new TestWriteLine("One", "One wont execute");
            TestWriteLine w3       = new TestWriteLine("Three", "Three wont execute");
            TestWriteLine w2True   = new TestWriteLine("True", "True will execute");
            TestWriteLine w2False  = new TestWriteLine("False", "False wont execute");

            TestFlowStep fs1 = new TestFlowStep(w1);
            TestFlowStep fs3 = new TestFlowStep(w3);

            Variable <int> margin = VariableHelper.CreateInitialized <int>("Margin", 10);

            flowchart.Variables.Add(margin);
            TestFlowConditional flowDecision = new TestFlowConditional(HintTrueFalse.True)
            {
                ConditionExpression = (context => margin.Get(context) > 0)
            };

            flowchart.AddConditionalLink(null, flowDecision, w2True, w2False);

            Dictionary <string, TestFlowElement> cases = new Dictionary <string, TestFlowElement>();

            cases.Add("One", fs1);
            cases.Add("Two", flowDecision);
            cases.Add("Three", fs3);

            List <int> hints = new List <int>();

            hints.Add(1);

            flowchart.AddStartLink(wStart);
            flowchart.AddSwitchLink <string>(wStart, cases, hints, "Two", wDefault);

            TestRuntime.RunAndValidateWorkflow(flowchart);
        }