コード例 #1
0
        public void DifferentArguments()
        {
            //Testing Different argument types for While.Condition
            // DelegateInArgument
            // DelegateOutArgument
            // Variable<T> , Activity<T> and Expression is already implemented.

            DelegateInArgument <bool>  delegateInArgument  = new DelegateInArgument <bool>("Condition");
            DelegateOutArgument <bool> delegateOutArgument = new DelegateOutArgument <bool>("Output");

            TestCustomActivity <InvokeFunc <bool, bool> > invokeFunc = TestCustomActivity <InvokeFunc <bool, bool> > .CreateFromProduct(
                new InvokeFunc <bool, bool>
            {
                Argument = true,
                Func     = new ActivityFunc <bool, bool>
                {
                    Argument = delegateInArgument,
                    Result   = delegateOutArgument,
                    Handler  = new Microsoft.CoreWf.Statements.Sequence
                    {
                        DisplayName = "Sequence1",
                        Activities  =
                        {
                            new Microsoft.CoreWf.Statements.While
                            {
                                DisplayName = "While1",
                                Condition   = ExpressionServices.Convert <bool>(ctx => delegateInArgument.Get(ctx)),
                                Body        = new Microsoft.CoreWf.Statements.Assign <bool>
                                {
                                    DisplayName = "Assign1",
                                    To          = delegateInArgument,
                                    Value       = new Microsoft.CoreWf.Expressions.Not <bool, bool> {
                                        Operand = delegateInArgument, DisplayName = "Not<Boolean,Boolean>"
                                    }
                                },
                            },
                            new Microsoft.CoreWf.Statements.Assign <bool>
                            {
                                DisplayName = "Assign2",
                                To          = delegateOutArgument,
                                Value       = new Microsoft.CoreWf.Expressions.Not <bool, bool> {
                                    Operand = delegateInArgument, DisplayName = "Not<Boolean,Boolean>"
                                },
                            },
                            new Microsoft.CoreWf.Statements.While
                            {
                                DisplayName = "While2",
                                Condition   = ExpressionServices.Convert <bool>(ctx => delegateOutArgument.Get(ctx)),
                                Body        = new Microsoft.CoreWf.Statements.Assign <bool>
                                {
                                    DisplayName = "Assign3",
                                    To          = delegateOutArgument,
                                    Value       = new Microsoft.CoreWf.Expressions.Not <bool, bool> {
                                        Operand = delegateOutArgument, DisplayName = "Not<Boolean,Boolean>"
                                    }
                                },
                            },
                        },
                    }
                }
            }
                );

            TestSequence sequenceForTracing = new TestSequence
            {
                DisplayName = "Sequence1",
                Activities  =
                {
                    new TestDoWhile
                    {
                        DisplayName            = "While1",
                        ActivitySpecificTraces =
                        {
                            new OrderedTraces()
                            {
                                Steps =
                                {
                                    new ActivityTrace("DelegateArgumentValue<Boolean>", ActivityInstanceState.Executing),
                                    new ActivityTrace("DelegateArgumentValue<Boolean>", ActivityInstanceState.Closed),
                                    new ActivityTrace("Assign1",                        ActivityInstanceState.Executing),
                                    new ActivityTrace("Not<Boolean,Boolean>",           ActivityInstanceState.Executing),
                                    new ActivityTrace("Not<Boolean,Boolean>",           ActivityInstanceState.Closed),
                                    new ActivityTrace("Assign1",                        ActivityInstanceState.Closed),
                                    new ActivityTrace("DelegateArgumentValue<Boolean>", ActivityInstanceState.Executing),
                                    new ActivityTrace("DelegateArgumentValue<Boolean>", ActivityInstanceState.Closed),
                                }
                            },
                        }
                    },
                    new TestAssign <bool>
                    {
                        DisplayName   = "Assign2",
                        ValueActivity = new Test.Common.TestObjects.Activities.Expressions.TestNot <bool, bool>{
                            DisplayName = "Not<Boolean,Boolean>"
                        }
                    },
                    new TestDoWhile
                    {
                        DisplayName            = "While2",
                        ActivitySpecificTraces =
                        {
                            new OrderedTraces()
                            {
                                Steps =
                                {
                                    new ActivityTrace("DelegateArgumentValue<Boolean>", ActivityInstanceState.Executing),
                                    new ActivityTrace("DelegateArgumentValue<Boolean>", ActivityInstanceState.Closed),
                                    new ActivityTrace("Assign3",                        ActivityInstanceState.Executing),
                                    new ActivityTrace("Not<Boolean,Boolean>",           ActivityInstanceState.Executing),
                                    new ActivityTrace("Not<Boolean,Boolean>",           ActivityInstanceState.Closed),
                                    new ActivityTrace("Assign3",                        ActivityInstanceState.Closed),
                                    new ActivityTrace("DelegateArgumentValue<Boolean>", ActivityInstanceState.Executing),
                                    new ActivityTrace("DelegateArgumentValue<Boolean>", ActivityInstanceState.Closed),
                                }
                            },
                        }
                    },
                }
            };

            invokeFunc.CustomActivityTraces.Add(sequenceForTracing.GetExpectedTrace().Trace);


            TestIf root = new TestIf(HintThenOrElse.Else)
            {
                ConditionActivity = invokeFunc,
                ThenActivity      = new TestWriteLine {
                    Message = "True", HintMessage = "This is not expected"
                },
                ElseActivity = new TestWriteLine {
                    Message = "False", HintMessage = "False"
                },
            };

            TestRuntime.RunAndValidateWorkflow(root);
        }
コード例 #2
0
        public static Constraint SetReceiveRequestSendResponseScopeExecutionPropertyFactory()
        {
            DelegateInArgument <ReceiveRequestSendResponseScope> element = new DelegateInArgument <ReceiveRequestSendResponseScope>();
            DelegateInArgument <ValidationContext> context = new DelegateInArgument <ValidationContext>();

            DelegateInArgument <Activity> child = new DelegateInArgument <Activity>();

            return(new Constraint <ReceiveRequestSendResponseScope>
            {
                Body = new ActivityAction <ReceiveRequestSendResponseScope, ValidationContext>
                {
                    Argument1 = element,
                    Argument2 = context,
                    Handler = new ForEach <Activity>
                    {
                        Values = new GetChildSubtree
                        {
                            ValidationContext = context,
                        },
                        Body = new ActivityAction <Activity>
                        {
                            Argument = child,
                            Handler = new If
                            {
                                Condition = new InArgument <bool>((env) => child.Get(env) is ISendResponse),
                                Then = new ReceiveRequestSendResponseScope.ReceiveRequestSendResponseScopeExecutionPropertyFactorySetter
                                {
                                    ISendResponse = new InArgument <ISendResponse>((env) => child.Get(env) as ISendResponse),
                                    ReceiveRequestSendResponseScope = new InArgument <ReceiveRequestSendResponseScope>((env) => element.Get(env)),
                                },
                            },
                        },
                    },
                },
            });
        }
コード例 #3
0
        public void SetDelegateArgument()
        {
            // for using delegate argument

            TheStruct valueType             = new TheStruct();
            int       indiceValue           = 2;
            DelegateInArgument <int> indice = new DelegateInArgument <int>();
            Variable <TheStruct>     var    = VariableHelper.CreateInitialized <TheStruct>("var", valueType);
            TestValueTypeIndexerReference <TheStruct, int> valueTypeIndexerReference = new TestValueTypeIndexerReference <TheStruct, int>()
            {
                OperandLocationVariable = var,
            };

            valueTypeIndexerReference.Indices.Add(new TestArgument <int>(Direction.In, null, (env) => indice.Get(env)));

            int value = 321;
            TestAssign <int> testAssign = new TestAssign <int>()
            {
                ToLocation = valueTypeIndexerReference, Value = value
            };

            TestSequence seq = new TestSequence()
            {
                Activities =
                {
                    testAssign,
                    new TestWriteLine {
                        MessageExpression = ((ctx) => var.Get(ctx)[indiceValue].ToString())
                    }
                }
            };

            System.Activities.Statements.Sequence outerSeq = new System.Activities.Statements.Sequence()
            {
                Variables =
                {
                    var
                },
                Activities =
                {
                    new InvokeAction <int>()
                    {
                        Argument = indiceValue,
                        Action   = new ActivityAction <int>()
                        {
                            Argument = indice,
                            Handler  = seq.ProductActivity
                        }
                    }
                }
            };

            TestCustomActivity testActivity = TestCustomActivity <System.Activities.Statements.Sequence> .CreateFromProduct(outerSeq);

            UnorderedTraces traces = new UnorderedTraces()
            {
                Steps =
                {
                    new UserTrace(value.ToString())
                }
            };

            testActivity.ActivitySpecificTraces.Add(traces);
            ExpectedTrace expectedTrace = testActivity.GetExpectedTrace();

            expectedTrace.AddIgnoreTypes(typeof(ActivityTrace));

            TestRuntime.RunAndValidateWorkflow(testActivity, expectedTrace);
        }
コード例 #4
0
        public static Constraint SetWorkflowInterfaceOperationNames()
        {
            DelegateInArgument <ReceiveRequestSendResponseScope> element = new DelegateInArgument <ReceiveRequestSendResponseScope>();
            DelegateInArgument <ValidationContext> context = new DelegateInArgument <ValidationContext>();

            DelegateInArgument <Activity> parent         = new DelegateInArgument <Activity>();
            DelegateInArgument <Activity> child          = new DelegateInArgument <Activity>();
            Variable <IOperationActivity> receiveRequest = new Variable <IOperationActivity>();
            Variable <Type> workflowInterfaceType        = new Variable <Type>();
            Variable <Type> requestResultType            = new Variable <Type>();
            Variable <Type> responseParameterType        = new Variable <Type>();

            return(new Constraint <ReceiveRequestSendResponseScope>
            {
                Body = new ActivityAction <ReceiveRequestSendResponseScope, ValidationContext>
                {
                    Argument1 = element,
                    Argument2 = context,
                    Handler = new Sequence
                    {
                        Variables =
                        {
                            receiveRequest,
                            workflowInterfaceType,
                            requestResultType,
                            responseParameterType,
                        },
                        Activities =
                        {
                            new ForEach <Activity>
                            {
                                Values = new GetParentChain
                                {
                                    ValidationContext = context,
                                },
                                Body = new ActivityAction <Activity>
                                {
                                    Argument = parent,
                                    Handler = new If
                                    {
                                        Condition = new InArgument <bool>((env) => parent.Get(env).IsWorkflowActivity()),
                                        Then = new Assign <Type>
                                        {
                                            Value = new InArgument <Type>((env) => parent.Get(env).GetWorkflowActivityType().GetGenericArguments()[(int)TypeParameterIndex.WorkflowInterface]),
                                            To = workflowInterfaceType,
                                        },
                                    },
                                },
                            },
                            new ForEach <Activity>
                            {
                                Values = new GetChildSubtree
                                {
                                    ValidationContext = context,
                                },
                                Body = new ActivityAction <Activity>
                                {
                                    Argument = child,
                                    Handler = new Sequence
                                    {
                                        Activities =
                                        {
                                            new If
                                            {
                                                Condition = new InArgument <bool>((env) => child.Get(env) is IReceiveRequest),
                                                Then = new Sequence
                                                {
                                                    Activities =
                                                    {
                                                        new Assign <IOperationActivity>
                                                        {
                                                            Value = new InArgument <IOperationActivity>((env) => child.Get(env) as IOperationActivity),
                                                            To = receiveRequest
                                                        },
                                                        new Assign <Type>
                                                        {
                                                            Value = new InArgument <Type>((env) => (child.Get(env) as IReceiveRequest).RequestResultType),
                                                            To = requestResultType
                                                        },
                                                    },
                                                },
                                            },
                                            new If
                                            {
                                                Condition = new InArgument <bool>((env) => child.Get(env) is ISendResponse),
                                                Then = new Assign <Type>
                                                {
                                                    Value = new InArgument <Type>((env) => (child.Get(env) as ISendResponse).ResponseParameterType),
                                                    To = responseParameterType
                                                },
                                            },
                                        },
                                    },
                                },
                            },
                            new WorkflowInterfaceOperationNamesSetter
                            {
                                ReceiveRequest = new InArgument <IOperationActivity>((env) => receiveRequest.Get(env)),
                                WorkflowInterfaceType = new InArgument <Type>((env) => workflowInterfaceType.Get(env)),
                                RequestResultType = new InArgument <Type>((env) => requestResultType.Get(env)),
                                ResponseParameterType = new InArgument <Type>((env) => responseParameterType.Get(env)),
                            },
                        },
                    },
                },
            });
        }
コード例 #5
0
        public static Constraint VerifyReceiveRequestSendResponseScopeChildren()
        {
            DelegateInArgument <ReceiveRequestSendResponseScope> element = new DelegateInArgument <ReceiveRequestSendResponseScope>();
            DelegateInArgument <ValidationContext> context = new DelegateInArgument <ValidationContext>();

            DelegateInArgument <Activity> child  = new DelegateInArgument <Activity>();
            Variable <int> receiveRequestCounter = new Variable <int>();
            Variable <int> sendResponseCounter   = new Variable <int>();

            return(new Constraint <ReceiveRequestSendResponseScope>
            {
                Body = new ActivityAction <ReceiveRequestSendResponseScope, ValidationContext>
                {
                    Argument1 = element,
                    Argument2 = context,
                    Handler = new Sequence
                    {
                        Variables =
                        {
                            receiveRequestCounter,
                            sendResponseCounter,
                        },
                        Activities =
                        {
                            new Assign <int>
                            {
                                Value = 0,
                                To = receiveRequestCounter,
                            },
                            new Assign <int>
                            {
                                Value = 0,
                                To = sendResponseCounter,
                            },
                            new ForEach <Activity>
                            {
                                Values = new GetChildSubtree
                                {
                                    ValidationContext = context,
                                },
                                Body = new ActivityAction <Activity>
                                {
                                    Argument = child,
                                    Handler = new Sequence
                                    {
                                        Activities =
                                        {
                                            new If
                                            {
                                                Condition = new InArgument <bool>((env) => child.Get(env) is IReceiveRequest),
                                                Then = new Assign <int>
                                                {
                                                    Value = new InArgument <int>((env) => receiveRequestCounter.Get(env) + 1),
                                                    To = receiveRequestCounter
                                                },
                                            },
                                            new If
                                            {
                                                Condition = new InArgument <bool>((env) => child.Get(env) is ISendResponse),
                                                Then = new Assign <int>
                                                {
                                                    Value = new InArgument <int>((env) => sendResponseCounter.Get(env) + 1),
                                                    To = sendResponseCounter
                                                },
                                            },
                                        },
                                    },
                                },
                            },
                            new AssertValidation
                            {
                                Assertion = new InArgument <bool>((env) => receiveRequestCounter.Get(env) == 1),
                                Message = new InArgument <string> ($"{nameof(ReceiveRequestSendResponseScope)} activity must contain one and only one {nameof(ReceiveRequest)} activity"),
                                PropertyName = new InArgument <string>((env) => element.Get(env).DisplayName)
                            },
                            new AssertValidation
                            {
                                Assertion = new InArgument <bool>((env) => sendResponseCounter.Get(env) == 1),
                                Message = new InArgument <string> ($"{nameof(ReceiveRequestSendResponseScope)} activity must contain one and only one {nameof(SendResponse)} activity"),
                                PropertyName = new InArgument <string>((env) => element.Get(env).DisplayName)
                            },
                        },
                    },
                },
            });
        }
コード例 #6
0
        public void ParallelForEachWithWorkflowInvoker()
        {
            TestSequence innerSequence    = new TestSequence("innerSeq");
            DelegateInArgument <string> i = new DelegateInArgument <string>()
            {
                Name = "i"
            };

            string[] strArray = new string[] { "var1", "var2", "var3" };

            TestParallelForEach <string> foreachAct = new TestParallelForEach <string>("foreach");

            foreachAct.HintValues         = strArray;
            foreachAct.ValuesExpression   = (context => new string[] { "var1", "var2", "var3" });
            foreachAct.CurrentVariable    = i;
            foreachAct.HintIterationCount = 3;

            TestWriteLine writeLine = new TestWriteLine("write hello");

            writeLine.MessageExpression = ((env) => string.Format("WriteLine Argument: {0}", i.Get(env)));

            for (int counter = strArray.Length - 1; counter > -1; counter--)
            {
                writeLine.HintMessageList.Add("WriteLine Argument: " + strArray[counter]);
            }

            foreachAct.Body = innerSequence;

            innerSequence.Activities.Add(writeLine);

            TestRuntime.RunAndValidateUsingWorkflowInvoker(foreachAct, null, null, null);
        }
コード例 #7
0
        private Constraint ProcessParentChainConstraints()
        {
            DelegateInArgument <System.Activities.Statements.TransactionScope> element = new DelegateInArgument <System.Activities.Statements.TransactionScope> {
                Name = "element"
            };
            DelegateInArgument <ValidationContext> argument = new DelegateInArgument <ValidationContext> {
                Name = "validationContext"
            };
            DelegateInArgument <Activity> argument2 = new DelegateInArgument <Activity> {
                Name = "parent"
            };
            Constraint <System.Activities.Statements.TransactionScope> constraint = new Constraint <System.Activities.Statements.TransactionScope>();
            ActivityAction <System.Activities.Statements.TransactionScope, ValidationContext> action = new ActivityAction <System.Activities.Statements.TransactionScope, ValidationContext> {
                Argument1 = element,
                Argument2 = argument
            };
            Sequence           sequence = new Sequence();
            ForEach <Activity> item     = new ForEach <Activity>();
            GetParentChain     chain    = new GetParentChain {
                ValidationContext = argument
            };

            item.Values = chain;
            ActivityAction <Activity> action2 = new ActivityAction <Activity> {
                Argument = argument2
            };
            Sequence sequence2             = new Sequence();
            If       @if                   = new If();
            Equal <Type, Type, bool> equal = new Equal <Type, Type, bool>();
            ObtainType type                = new ObtainType {
                Input = argument2
            };

            equal.Left    = type;
            equal.Right   = new InArgument <Type>(context => typeof(System.Activities.Statements.TransactionScope));
            @if.Condition = equal;
            Sequence         sequence3  = new Sequence();
            AssertValidation validation = new AssertValidation {
                IsWarning = 1
            };
            AbortInstanceFlagValidator validator = new AbortInstanceFlagValidator {
                ParentActivity   = argument2,
                TransactionScope = new InArgument <System.Activities.Statements.TransactionScope>(context => element.Get(context))
            };

            validation.Assertion    = validator;
            validation.Message      = new InArgument <string>(System.Activities.SR.AbortInstanceOnTransactionFailureDoesNotMatch);
            validation.PropertyName = "AbortInstanceOnTransactionFailure";
            sequence3.Activities.Add(validation);
            AssertValidation        validation2 = new AssertValidation();
            IsolationLevelValidator validator2  = new IsolationLevelValidator {
                ParentActivity        = argument2,
                CurrentIsolationLevel = new InArgument <System.Transactions.IsolationLevel>(context => element.Get(context).IsolationLevel)
            };

            validation2.Assertion    = validator2;
            validation2.Message      = new InArgument <string>(System.Activities.SR.IsolationLevelValidation);
            validation2.PropertyName = "IsolationLevel";
            sequence3.Activities.Add(validation2);
            @if.Then = sequence3;
            sequence2.Activities.Add(@if);
            action2.Handler = sequence2;
            item.Body       = action2;
            sequence.Activities.Add(item);
            action.Handler  = sequence;
            constraint.Body = action;
            return(constraint);
        }
コード例 #8
0
        public void ParallelForEachWithAChildThatOverridesCancelAndCompletionConditionIsTrue()
        {
            Variable <bool> cancelIt = new Variable <bool> {
                Name = "cancelIt", Default = false
            };
            DelegateInArgument <bool> arg = new DelegateInArgument <bool>("arg");

            TestParallelForEach <bool> pfeAct = new TestParallelForEach <bool>
            {
                DisplayName                 = "ParallelForEach1",
                HintIterationCount          = 2,
                HintValues                  = new bool[] { true, false },
                ValuesExpression            = (e => new bool[] { true, false }),
                CurrentVariable             = arg,
                CompletionConditionVariable = cancelIt,
                Body = new TestIf(HintThenOrElse.Then, HintThenOrElse.Else)
                {
                    DisplayName         = "If1",
                    ConditionExpression = e => arg.Get(e),
                    ThenActivity        = new TestBlockingActivityWithWriteLineInCancel("writeLineInCancel", OutcomeState.Completed)
                    {
                        ExpectedOutcome = new Outcome(OutcomeState.Completed, OutcomeState.Canceled),
                    },
                    ElseActivity = new TestSequence
                    {
                        DisplayName = "Sequence2",
                        Activities  =
                        {
                            new TestDelay("d1", new TimeSpan(1)),
                            new TestAssign <bool> {
                                DisplayName = "Assign1",Value = true,    ToVariable       = cancelIt
                            }
                        }
                    }
                },
            };

            TestSequence root = new TestSequence
            {
                DisplayName = "Sequence1",
                Activities  = { pfeAct },
                Variables   = { cancelIt },
            };

            OrderedTraces ordered = new OrderedTraces()
            {
                Steps =
                {
                    new ActivityTrace("Sequence1",                              ActivityInstanceState.Executing),
                    new ActivityTrace("ParallelForEach1",                       ActivityInstanceState.Executing),
                    new UnorderedTraces
                    {
                        Steps =
                        {
                            new OrderedTraces()
                            {
                                Steps =
                                {
                                    new ActivityTrace("If1",               ActivityInstanceState.Executing),
                                    new ActivityTrace("writeLineInCancel", ActivityInstanceState.Executing),
                                    new ActivityTrace("w1",                ActivityInstanceState.Executing),
                                    new ActivityTrace("w1",                ActivityInstanceState.Closed),
                                    new ActivityTrace("writeLineInCancel", ActivityInstanceState.Closed),
                                    new ActivityTrace("If1",               ActivityInstanceState.Closed),
                                }
                            },
                            new OrderedTraces()
                            {
                                Steps =
                                {
                                    new ActivityTrace("If1",                    ActivityInstanceState.Executing),
                                    new ActivityTrace("Sequence2",              ActivityInstanceState.Executing),
                                    new ActivityTrace("d1",                     ActivityInstanceState.Executing),
                                    new ActivityTrace("d1",                     ActivityInstanceState.Closed),
                                    new ActivityTrace("Assign1",                ActivityInstanceState.Executing),
                                    new ActivityTrace("Assign1",                ActivityInstanceState.Closed),
                                    new ActivityTrace("Sequence2",              ActivityInstanceState.Closed),
                                    new ActivityTrace("If1",                    ActivityInstanceState.Closed),
                                    new ActivityTrace("VariableValue<Boolean>", ActivityInstanceState.Executing),
                                    new ActivityTrace("VariableValue<Boolean>", ActivityInstanceState.Closed),
                                }
                            }
                        }
                    },
                    new ActivityTrace("ParallelForEach1",                       ActivityInstanceState.Closed),
                    new ActivityTrace("Sequence1",                              ActivityInstanceState.Closed),
                }
            };

            ExpectedTrace trace = new ExpectedTrace(ordered);

            trace.AddIgnoreTypes(typeof(SynchronizeTrace));
            trace.AddIgnoreTypes(typeof(BookmarkResumptionTrace));
            TestRuntime.RunAndValidateWorkflow(root, trace);
        }
コード例 #9
0
        static Activity CreateAverageCalculationWorkflow()
        {
            // Variables
            var iterationVariable = new DelegateInArgument <int>()
            {
                Name = "iterationVariable"
            };
            var accumulator = new Variable <int>()
            {
                Default = 0, Name = "accumulator"
            };

            // Define the Input and Output arguments that the DynamicActivity binds to
            var numbers = new InArgument <List <int> >();
            var average = new OutArgument <double>();

            var result = new Variable <double>()
            {
                Name = "result"
            };

            return(new DynamicActivity()
            {
                DisplayName = "Find average",
                Properties =
                {
                    // Input argument
                    new DynamicActivityProperty
                    {
                        Name = "Numbers",
                        Type = typeof(InArgument <List <int> >),
                        Value = numbers
                    },
                    // Output argument
                    new DynamicActivityProperty
                    {
                        Name = "Average",
                        Type = typeof(OutArgument <double>),
                        Value = average
                    }
                },
                Implementation = () =>
                                 new Sequence
                {
                    Variables = { result, accumulator },
                    Activities =
                    {
//<Snippet1>
                        new ForEach <int>
                        {
                            Values = new ArgumentValue <IEnumerable <int> >{
                                ArgumentName = "Numbers"
                            },
                            Body = new ActivityAction <int>
                            {
                                Argument = iterationVariable,
                                Handler = new Assign <int>
                                {
                                    To = accumulator,
                                    Value = new InArgument <int>(env => iterationVariable.Get(env) + accumulator.Get(env))
                                }
                            }
                        },
//</Snippet1>

                        // Calculate the average and assign to the output argument.
                        new Assign <double>
                        {
                            To = new ArgumentReference <double>{
                                ArgumentName = "Average"
                            },
                            Value = new InArgument <double>(env => accumulator.Get(env) / numbers.Get(env).Count <int>())
                        },
                    }
                }
            });
        }
コード例 #10
0
        public void MultipleBranchesMultipleChildren()
        {
            TimeSpan time = new TimeSpan(0, 0, 2);

            DelegateInArgument <string> currentVariable = new DelegateInArgument <string>()
            {
                Name = "currentVariable"
            };
            DelegateInArgument <string> currentVariable1 = new DelegateInArgument <string>()
            {
                Name = "currentVariable1"
            };
            DelegateInArgument <string> currentVariable2 = new DelegateInArgument <string>()
            {
                Name = "currentVariable2"
            };
            DelegateInArgument <string> currentVariable3 = new DelegateInArgument <string>()
            {
                Name = "currentVariable3"
            };


            #region Sequence
            TestSequence sequence = new TestSequence()
            {
                Activities =
                {
                    new TestWriteLine("WritelineAct1", "Hello"),
                    new TestIf("If act1",              HintThenOrElse.Then)
                    {
                        Condition    = true,
                        ThenActivity = new TestWriteLine("Writeline in then1")
                        {
                            Message = "I am writeline in if activity"
                        }
                    },

                    new TestDelay("Delay act1",        time),

                    new TestParallelForEach <string>("Parallel For Each In sequence")
                    {
                        HintValues = new List <string>()
                        {
                            "Element1",                "Element2"
                        },
                        ValuesExpression = (context => new List <string>()
                        {
                            "Element1",                "Element2"
                        }),
                        CurrentVariable  = currentVariable,
                        Body             = new TestWriteLine()
                        {
                            MessageExpression = (env) => (string)currentVariable.Get(env),
                            HintMessageList   = { "Element2", "Element1" }
                        },

                        HintIterationCount = 2
                    },

                    new TestTryCatch()
                    {
                        Try = new TestThrow <NullReferenceException>()
                        {
                            ExpectedOutcome = Outcome.CaughtException()
                        },
                        Catches =
                        {
                            new TestCatch <NullReferenceException>()
                        }
                    }
                }
            };
            #endregion // Sequence

            #region Sequence1
            TestSequence sequence1 = new TestSequence()
            {
                Activities =
                {
                    new TestWriteLine("WritelineAct2", "Hello"),
                    new TestIf("If act2",              HintThenOrElse.Then)
                    {
                        Condition    = true,
                        ThenActivity = new TestWriteLine("Writeline in then","I am writeline in if activity")
                    },

                    new TestDelay("Delay act2",        time),

                    new TestParallelForEach <string>("Parallel For Each In sequence1")
                    {
                        HintValues = new List <string>()
                        {
                            "Element1",                "Element2"
                        },
                        ValuesExpression = (context => new List <string>()
                        {
                            "Element1",                "Element2"
                        }),
                        CurrentVariable  = currentVariable1,
                        Body             = new TestWriteLine("Writeline in PFE")
                        {
                            MessageExpression = (env) => (string)currentVariable1.Get(env),
                            HintMessageList   = { "Element2", "Element1" }
                        },

                        HintIterationCount = 2
                    },

                    new TestTryCatch()
                    {
                        Try = new TestThrow <NullReferenceException>()
                        {
                            ExpectedOutcome = Outcome.CaughtException()
                        },
                        Catches =
                        {
                            new TestCatch <NullReferenceException>()
                        }
                    }
                }
            };

            #endregion // Sequence1

            #region Sequence2
            TestSequence sequence2 = new TestSequence()
            {
                Activities =
                {
                    new TestWriteLine("WritelineAct3", "Hello"),
                    new TestIf("If act3",              HintThenOrElse.Then)
                    {
                        Condition    = true,
                        ThenActivity = new TestWriteLine("Writeline in then","I am writeline in if activity")
                    },

                    new TestDelay("Delay act3",        time),

                    new TestParallelForEach <string>("Parallel For Each In sequence2")
                    {
                        HintValues = new List <string>()
                        {
                            "Element1",                "Element2"
                        },
                        ValuesExpression = (context => new List <string>()
                        {
                            "Element1",                "Element2"
                        }),
                        CurrentVariable  = currentVariable2,
                        Body             = new TestWriteLine("Writeline in PFE")
                        {
                            MessageExpression = (env) => (string)currentVariable2.Get(env),
                            HintMessageList   = { "Element2", "Element1" }
                        },

                        HintIterationCount = 2
                    },

                    new TestTryCatch()
                    {
                        Try = new TestThrow <NullReferenceException>()
                        {
                            ExpectedOutcome = Outcome.CaughtException()
                        },
                        Catches =
                        {
                            new TestCatch <NullReferenceException>()
                        }
                    }
                }
            };
            #endregion // Sequence2

            #region Sequence3

            TestSequence sequence3 = new TestSequence()
            {
                Activities =
                {
                    new TestWriteLine("WritelineAct4", "Hello"),
                    new TestIf("If act4",              HintThenOrElse.Then)
                    {
                        Condition    = true,
                        ThenActivity = new TestWriteLine("Writeline in then","I am writeline in if activity")
                    },

                    new TestDelay("Delay act4",        time),

                    new TestParallelForEach <string>("Parallel For Each In sequence3")
                    {
                        HintValues = new List <string>()
                        {
                            "Element1",                "Element2"
                        },
                        ValuesExpression = (context => new List <string>()
                        {
                            "Element1",                "Element2"
                        }),
                        CurrentVariable  = currentVariable3,
                        Body             = new TestWriteLine("Writeline in PFE")
                        {
                            MessageExpression = (env) => (string)currentVariable3.Get(env),
                            HintMessageList   = { "Element2", "Element1" }
                        },

                        HintIterationCount = 2
                    },

                    new TestTryCatch()
                    {
                        Try = new TestThrow <NullReferenceException>()
                        {
                            ExpectedOutcome = Outcome.CaughtException()
                        },

                        Catches =
                        {
                            new TestCatch <NullReferenceException>()
                        }
                    }
                }
            };
            #endregion Sequence2

            TestParallel parallelAct = new TestParallel("ParallelActivity")
            {
                Branches =
                {
                    new TestSequence("First Sequence")
                    {
                        Activities ={ sequence                  }
                    },

                    // Second sequence
                    new TestSequence("Second sequence")
                    {
                        Activities ={ sequence1                 }
                    },

                    // Third sequence
                    new TestSequence("Third sequence")
                    {
                        Activities ={ sequence2                 }
                    },

                    // Fourth Sequence
                    new TestSequence("Fourth Sequence")
                    {
                        Activities ={ sequence3                 }
                    }
                },

                HintNumberOfBranchesExecution = 4
            };

            ExpectedTrace trace = parallelAct.GetExpectedTrace();
            TestRuntime.RunAndValidateWorkflow(parallelAct, trace);
        }
コード例 #11
0
        public static Constraint HasParent <TActivity>(Func <Activity, bool> condition, string validationMessage)
            where TActivity : Activity
        {
            var element = new DelegateInArgument <TActivity>();
            DelegateInArgument <ValidationContext> context = new DelegateInArgument <ValidationContext>();
            Variable <bool> result = new Variable <bool>();
            DelegateInArgument <Activity> parent = new DelegateInArgument <Activity>();

            return(new Constraint <TActivity>
            {
                Body = new ActivityAction <TActivity, ValidationContext>()
                {
                    Argument1 = element,
                    Argument2 = context,
                    Handler = new Sequence()
                    {
                        Variables =
                        {
                            result
                        },
                        Activities =
                        {
                            new  ForEach <Activity>()
                            {
                                Values = new GetParentChain
                                {
                                    ValidationContext = context
                                },
                                Body = new ActivityAction <Activity>()
                                {
                                    Argument = parent,
                                    Handler = new If()
                                    {
                                        Condition = new InArgument <bool>(ctx => condition(parent.Get(ctx))),
                                        Then = new Assign <bool>
                                        {
                                            Value = true,
                                            To = result
                                        }
                                    }
                                }
                            },
                            new AssertValidation()
                            {
                                Assertion = new InArgument <bool>(result),
                                Message = new InArgument <string> (validationMessage),
                            }
                        }
                    }
                }
            });
        }
コード例 #12
0
        public void BasicParallelForEachTest()
        {
            TestSequence outerSequence    = new TestSequence("sequence1");
            TestSequence innerSequence    = new TestSequence("innerSeq");
            DelegateInArgument <string> i = new DelegateInArgument <string>()
            {
                Name = "i"
            };

            string[] strArray = new string[] { "var1", "var2", "var3" };

            TestParallelForEach <string> foreachAct = new TestParallelForEach <string>("foreach")
            {
                HintValues         = new string[] { "var1", "var2", "var3" },
                ValuesExpression   = (context => new string[] { "var1", "var2", "var3" }),
                CurrentVariable    = i,
                HintIterationCount = 3
            };

            TestWriteLine writeLine = new TestWriteLine("write hello")
            {
                MessageExpression = ((env) => string.Format("WriteLine Argument: {0}", i.Get(env)))
            };

            for (int counter = strArray.Length - 1; counter > -1; counter--)
            {
                writeLine.HintMessageList.Add("WriteLine Argument: " + strArray[counter]);
            }

            foreachAct.Body = innerSequence;

            innerSequence.Activities.Add(writeLine);
            outerSequence.Activities.Add(foreachAct);

            ExpectedTrace tr = outerSequence.GetExpectedTrace();

            TestRuntime.RunAndValidateWorkflow(outerSequence, tr);
        }
コード例 #13
0
        public static Constraint GetConstraint()
        {
            List <Type> allowedTypes = new List <Type>
            {
                typeof(Sequence),
                typeof(WriteLine),
                typeof(Assign)
            };

            List <String> allowedNamespaces = new List <String>
            {
                "Microsoft.VisualBasic.Activities",
                "System.Activities.Expressions"
            };

            Variable <Boolean> result =
                new Variable <Boolean>("result", true);
            DelegateInArgument <MySequenceWithConstraint> element =
                new DelegateInArgument <MySequenceWithConstraint>();
            DelegateInArgument <ValidationContext> vc =
                new DelegateInArgument <ValidationContext>();
            DelegateInArgument <Activity> child =
                new DelegateInArgument <Activity>();

            return(new Constraint <MySequenceWithConstraint>
            {
                Body = new ActivityAction
                       <MySequenceWithConstraint, ValidationContext>
                {
                    Argument1 = element,
                    Argument2 = vc,
                    Handler = new Sequence
                    {
                        Variables = { result },
                        Activities =
                        {
                            new ForEach <Activity>
                            {
                                Values = new GetChildSubtree
                                {
                                    ValidationContext = vc
                                },
                                Body = new ActivityAction <Activity>
                                {
                                    Argument = child,
                                    Handler = new If()
                                    {
                                        Condition = new InArgument <Boolean>(ac =>
                                                                             allowedTypes.Contains(
                                                                                 child.Get(ac).GetType()) ||
                                                                             allowedNamespaces.Contains(
                                                                                 child.Get(ac).GetType().Namespace)),
                                        Else = new Assign <Boolean>
                                        {
                                            To = result,
                                            Value = false
                                        }
                                    }
                                }
                            },
                            new AssertValidation
                            {
                                Assertion = new InArgument <Boolean>(result),
                                Message = new InArgument <String>(
                                    "Only Sequence, WriteLine, Assign allowed"),
                                PropertyName = new InArgument <String>(
                                    (env) => element.Get(env).DisplayName)
                            }
                        }
                    }
                }
            });
        }
コード例 #14
0
ファイル: Throw.cs プロジェクト: jimitndiaye/corewf
        public void ThrowWithInnerException()
        {
            // Initializing variable which we will use to catch the exception object
            DelegateInArgument <MemberAccessException> accExc = new DelegateInArgument <MemberAccessException>();
            //TestParameters.DisableXamlRoundTrip = true;
            TestSequence seq = new TestSequence("Outer Seq")
            {
                Activities =
                {
                    new TestTryCatch("Try catch finally")
                    {
                        Try = new TestSequence("Try Activity")
                        {
                            Activities =
                            {
                                new TestThrow <MemberAccessException>("Throw Operation exception")
                                {
                                    ExceptionExpression = (context => new MemberAccessException("Throw Exception", new IndexOutOfRangeException())),
                                    //InnerException = new IndexOutOfRangeException(),
                                    ExpectedOutcome = Outcome.CaughtException(),
                                }
                            }
                        },

                        Catches =
                        {
                            new TestCatch <MemberAccessException>()
                            {
                                ExceptionVariable = accExc,
                                Body = new TestSequence("Body of Catch")
                                {
                                    Activities =
                                    {
                                        // Rethrowing inner exception so we can verify correct exception is thrown
                                        new TestThrow <IndexOutOfRangeException>("Throw inner exception")
                                        {
                                            ExceptionExpression = (env) => (IndexOutOfRangeException)accExc.Get(env).InnerException,
                                            ExpectedOutcome     = Outcome.UncaughtException(typeof(IndexOutOfRangeException))
                                        }
                                    }
                                },
                            }
                        }
                    }
                }
            };

            TestRuntime.RunAndValidateAbortedException(seq, typeof(IndexOutOfRangeException), new Dictionary <string, string>());
        }
コード例 #15
0
        public void CancelChildOfParallelForEach()
        {
            DelegateInArgument <string> _currentVariable = new DelegateInArgument <string>()
            {
                Name = "_currentVariable"
            };

            TestParallelForEach <string> parallelForEach = new TestParallelForEach <string>("Parallel For Each Activity")
            {
                HintValues = new List <string>()
                {
                    "Hi", "There"
                },
                ValuesExpression = (context => new List <string>()
                {
                    "Hi", "There"
                }),
                CurrentVariable  = _currentVariable,
                Body             = new TestSequence("Body of parallel for each")
                {
                    Activities =
                    {
                        new TestWriteLine("Writeline in parallel for each")
                        {
                            MessageExpression = (env) => (string)_currentVariable.Get(env),
                            HintMessageList   = { "There",     "Hi" }
                        },

                        new TestIf("Test If", HintThenOrElse.Else, HintThenOrElse.Then)
                        {
                            ConditionExpression = (env) => (bool)(_currentVariable.Get(env).Equals("Hi")),

                            ThenActivity = new TestBlockingActivityUnique("BlockingActivity", "Bookmark")
                            {
                                ExpectedOutcome = Outcome.Canceled
                            },

                            ElseActivity = new TestWriteLine("Writeline in Else")
                            {
                                MessageExpression = (env) => (string)_currentVariable.Get(env),
                                HintMessage       = "There"
                            }
                        },

                        new TestWriteLine()
                        {
                            Message = "Hello"
                        }
                    }
                },

                HintIterationCount = 2
            };

            using (TestWorkflowRuntime testWorkflowRuntime = TestRuntime.CreateTestWorkflowRuntime(parallelForEach))
            {
                testWorkflowRuntime.ExecuteWorkflow();
                testWorkflowRuntime.WaitForActivityStatusChange("BlockingActivity", TestActivityInstanceState.Executing);
                testWorkflowRuntime.CancelWorkflow();
                testWorkflowRuntime.WaitForCanceled();
            }
        }
コード例 #16
0
        public static Constraint VerifyParentIsObjectContextScope(Activity activity)
        {
            DelegateInArgument <Activity>          element = new DelegateInArgument <Activity>();
            DelegateInArgument <ValidationContext> context = new DelegateInArgument <ValidationContext>();
            DelegateInArgument <Activity>          child   = new DelegateInArgument <Activity>();
            Variable <bool> result = new Variable <bool>();

            return(new Constraint <Activity>
            {
                Body = new ActivityAction <Activity, ValidationContext>
                {
                    Argument1 = element,
                    Argument2 = context,
                    Handler = new Sequence
                    {
                        Variables = { result },
                        Activities =
                        {
                            new ForEach <Activity>
                            {
                                Values = new GetParentChain
                                {
                                    ValidationContext = context
                                },
                                Body = new ActivityAction <Activity>
                                {
                                    Argument = child,
                                    Handler = new If
                                    {
                                        Condition = new InArgument <bool>((env) => object.Equals(child.Get(env).GetType(), typeof(ObjectContextScope))),
                                        Then = new Assign <bool>
                                        {
                                            Value = true,
                                            To = result
                                        }
                                    }
                                }
                            },
                            new AssertValidation
                            {
                                Assertion = new InArgument <bool>(env => result.Get(env)),
                                Message = new InArgument <string> (string.Format("{0} can only be added inside an ObjectContextScope activity.", activity.GetType().Name)),
                                PropertyName = new InArgument <string>((env) => element.Get(env).DisplayName)
                            }
                        }
                    }
                }
            });
        }
コード例 #17
0
        public void PersistParallelForEach()
        {
            DelegateInArgument <string> _currentVariable = new DelegateInArgument <string>()
            {
                Name = "_currentVariable"
            };

            TestParallelForEach <string> parallelForEach = new TestParallelForEach <string>("Parallel for each")
            {
                HintValues       = new string[] { "Hi", "There" },
                ValuesExpression = (context => new string[] { "Hi", "There" }),
                CurrentVariable  = _currentVariable,
                Body             = new TestSequence("Sequence")
                {
                    Activities =
                    {
                        new TestWriteLine("Writeline")
                        {
                            Message = "Hi"
                        },

                        new TestSequence("inner seq")
                        {
                            Activities =
                            {
                                new TestIf(HintThenOrElse.Else, HintThenOrElse.Then)
                                {
                                    DisplayName         = "Test if",
                                    ConditionExpression = (env) => (bool)(_currentVariable.Get(env).Equals("Hi")),
                                    ThenActivity        = new TestBlockingActivity("Block Hi"),
                                    ElseActivity        = new TestBlockingActivity("Block There")
                                }
                            }
                        },

                        new TestWriteLine("Writeline act")
                        {
                            Message = "After blocking activty"
                        },
                    }
                }
            };

            JsonFileInstanceStore.FileInstanceStore jsonStore = new JsonFileInstanceStore.FileInstanceStore(".\\~");

            using (TestWorkflowRuntime testWorkflowRuntime = TestRuntime.CreateTestWorkflowRuntime(parallelForEach, null, jsonStore, PersistableIdleAction.None))
            {
                testWorkflowRuntime.ExecuteWorkflow();
                testWorkflowRuntime.WaitForActivityStatusChange("Block Hi", TestActivityInstanceState.Executing);
                testWorkflowRuntime.PersistWorkflow();
                System.Threading.Thread.Sleep(2000);
                testWorkflowRuntime.ResumeBookMark("Block Hi", null);


                testWorkflowRuntime.WaitForActivityStatusChange("Block There", TestActivityInstanceState.Executing);
                testWorkflowRuntime.PersistWorkflow();
                System.Threading.Thread.Sleep(2000);
                testWorkflowRuntime.ResumeBookMark("Block There", null);

                testWorkflowRuntime.WaitForCompletion();
            }
        }
コード例 #18
0
        private static Constraint ConfirmWithNoTarget()
        {
            DelegateInArgument <Confirm> element = new DelegateInArgument <Confirm> {
                Name = "element"
            };
            DelegateInArgument <ValidationContext> validationContext = new DelegateInArgument <ValidationContext> {
                Name = "validationContext"
            };
            Variable <bool> assertFlag = new Variable <bool> {
                Name = "assertFlag"
            };
            Variable <IEnumerable <Activity> > elements = new Variable <IEnumerable <Activity> >()
            {
                Name = "elements"
            };
            Variable <int> index = new Variable <int>()
            {
                Name = "index"
            };

            return(new Constraint <Confirm>
            {
                Body = new ActivityAction <Confirm, ValidationContext>
                {
                    Argument1 = element,
                    Argument2 = validationContext,
                    Handler = new Sequence
                    {
                        Variables =
                        {
                            assertFlag,
                            elements,
                            index
                        },
                        Activities =
                        {
                            new If
                            {
                                Condition = new InArgument <bool>((env) => element.Get(env).Target != null),
                                Then = new Assign <bool>
                                {
                                    To = assertFlag,
                                    Value = true
                                },
                                Else = new Sequence
                                {
                                    Activities =
                                    {
                                        new Assign <IEnumerable <Activity> >
                                        {
                                            To = elements,
                                            Value = new GetParentChain
                                            {
                                                ValidationContext = validationContext,
                                            },
                                        },
                                        new While(env => (assertFlag.Get(env) != true) &&
                                                  index.Get(env) < elements.Get(env).Count())
                                        {
                                            Body = new Sequence
                                            {
                                                Activities =
                                                {
                                                    new If(env => (elements.Get(env).ElementAt(index.Get(env))).GetType() == typeof(CompensationParticipant))
                                                    {
                                                        Then = new Assign <bool>
                                                        {
                                                            To = assertFlag,
                                                            Value = true
                                                        },
                                                    },
                                                    new Assign <int>
                                                    {
                                                        To = index,
                                                        Value = new InArgument <int>(env => index.Get(env) + 1)
                                                    },
                                                }
                                            }
                                        }
                                    }
                                }
                            },
                            new AssertValidation
                            {
                                Assertion = new InArgument <bool>(assertFlag),
                                Message = new InArgument <string>(SR.ConfirmWithNoTargetConstraint)
                            }
                        }
                    }
                }
            });
        }
コード例 #19
0
        static Constraint CompensateWithNoTarget()
        {
            DelegateInArgument<Compensate> element = new DelegateInArgument<Compensate> { Name = "element" };
            DelegateInArgument<ValidationContext> validationContext = new DelegateInArgument<ValidationContext> { Name = "validationContext" };
            Variable<bool> assertFlag = new Variable<bool> { Name = "assertFlag" };
            Variable<IEnumerable<Activity>> elements = new Variable<IEnumerable<Activity>>() { Name = "elements" };
            Variable<int> index = new Variable<int>() { Name = "index" };

            return new Constraint<Compensate>
            {
                Body = new ActivityAction<Compensate, ValidationContext>
                {
                    Argument1 = element,
                    Argument2 = validationContext,
                    Handler = new Sequence
                    {
                        Variables = 
                        {
                            assertFlag,
                            elements,
                            index
                        },
                        Activities =
                        {
                            new If
                            {
                                Condition = new InArgument<bool>((env) => element.Get(env).Target != null),
                                Then = new Assign<bool>
                                {
                                    To = assertFlag,
                                    Value = true
                                },
                                Else = new Sequence
                                {
                                    Activities = 
                                    {
                                        new Assign<IEnumerable<Activity>>
                                        {
                                            To = elements,
                                            Value = new GetParentChain
                                            {
                                                ValidationContext = validationContext,
                                            },
                                        },
                                        new While(env => (assertFlag.Get(env) != true) && index.Get(env) < elements.Get(env).Count())
                                        {
                                            Body = new Sequence
                                            {
                                                Activities = 
                                                {
                                                    new If(env => (elements.Get(env).ElementAt(index.Get(env))).GetType() == typeof(CompensationParticipant))
                                                    {
                                                        Then = new Assign<bool>
                                                        {
                                                            To = assertFlag,
                                                            Value = true                                                            
                                                        },
                                                    },
                                                    new Assign<int>
                                                    {
                                                        To = index,
                                                        Value = new InArgument<int>(env => index.Get(env) + 1)
                                                    },
                                                }
                                            }
                                        }
                                    }
                                }                                
                            },
                            new AssertValidation
                            {
                                Assertion = new InArgument<bool>(assertFlag),
                                Message = new InArgument<string>(SR.CompensateWithNoTargetConstraint)   
                            }
                        }
                    }
                }
            };
        }
コード例 #20
0
        public static Constraint CheckParent <ParentType>()
        {
            DelegateInArgument <Activity>          element = new DelegateInArgument <Activity>();
            DelegateInArgument <ValidationContext> context = new DelegateInArgument <ValidationContext>();
            Variable <bool> result = new Variable <bool>();
            DelegateInArgument <Activity> parent = new DelegateInArgument <Activity>();

            return(new Constraint <Activity>
            {
                Body = new ActivityAction <Activity, ValidationContext>

                {
                    Argument1 = element,
                    Argument2 = context,
                    Handler = new Sequence
                    {
                        Variables =
                        {
                            result
                        },
                        Activities =
                        {
                            new ForEach <Activity>
                            {
                                Values = new GetParentChain
                                {
                                    ValidationContext = context
                                },
                                Body = new ActivityAction <Activity>
                                {
                                    Argument = parent,
                                    Handler = new If()
                                    {
                                        Condition = new InArgument <bool>((env) => object.Equals(parent.Get(env).GetType(), typeof(ParentType))),
                                        Then = new Assign <bool>
                                        {
                                            Value = true,
                                            To = result
                                        }
                                    }
                                }
                            },
                            new AssertValidation
                            {
                                Assertion = new InArgument <bool>(result),
                                Message = new InArgument <string> (string.Format("This activity has to be inside a {0} activity", typeof(ParentType).Name.ToString())),
                            }
                        }
                    }
                }
            });
        }