Esempio n. 1
0
        public void TestMultiplyGeneric()
        {
            var a = new System.Activities.Expressions.Multiply <long, long, long>()
            {
                Left  = 100,
                Right = 200,
            };

            var r = WorkflowInvoker.Invoke(a);

            Assert.Equal(20000L, r);
        }
Esempio n. 2
0
        public void TestMultiplyGenericThrows2()
        {
            Assert.Throws <InvalidWorkflowException>(() =>
            {
                var a = new System.Activities.Expressions.Multiply <int, long, long>()
                {
                    Left  = 100,
                    Right = 200L,
                };

                var r = WorkflowInvoker.Invoke(a);
            });
        }
        public void TestDynamicActivityGenericWithGeneric()
        {
            var x = 100;
            var y = 200;
            var a = new DynamicActivity <long>
            {
                DisplayName = "Dynamic Multiply",
                Properties  =
                {
                    new DynamicActivityProperty()
                    {
                        Name = "XX",
                        Type = typeof(InArgument <long>),
                    },
                    new DynamicActivityProperty()
                    {
                        Name = "YY",
                        Type = typeof(InArgument <long>),
                    },
                },

                Implementation = () =>
                {
                    var t1 = new Variable <long>("t1");

                    var multiply = new System.Activities.Expressions.Multiply <long, long, long>()
                    {
                        Left = new ArgumentValue <long>()
                        {
                            ArgumentName = "XX"
                        },
                        Right = new ArgumentValue <long>()
                        {
                            ArgumentName = "YY"
                        },
                        Result = t1,
                    };
                    var s = new System.Activities.Statements.Sequence()
                    {
                        Variables =
                        {
                            t1
                        },
                        Activities =
                        {
                            multiply,
                            new System.Activities.Statements.Assign <long>
                            {
                                To = new ArgumentReference <long> {
                                    ArgumentName = "Result"
                                },
                                Value = new InArgument <long>(env => t1.Get(env)),
                            },
                        },
                    };
                    return(s);
                },
            };

            var dic = new Dictionary <string, object>();

            dic.Add("XX", x);
            dic.Add("YY", y);

            var r = WorkflowInvoker.Invoke(a, dic);

            Assert.Equal(20000L, r);
        }