예제 #1
0
        public void InvokeWithExtensions()
        {
            var childActivity = new TestActivityWithExtensions();
            var target = new InvokeWorkflow();
            var incStore = new IncrementStore();
            var decStore = new DecrementStore();

            var extensions = new object[] { incStore, decStore };

            dynamic innerInput = new WorkflowArguments();
            innerInput.Num = 3;

            dynamic input = new WorkflowArguments();
            input.Activity = childActivity;
            input.Input = innerInput;
            input.Extensions = extensions;

            // inner dictionary gets passed to child
            var host = WorkflowInvokerTest.Create(target);

            try
            {
                host.TestActivity(input);
                Assert.AreEqual(4, incStore.Value);
                Assert.AreEqual(2, decStore.Value);
            }
            finally
            {
                host.Tracking.Trace();
            }
        }
예제 #2
0
        public void LoadAndInvokeWorkflowWithExtensions()
        {
            var target = new LoadAndInvokeWorkflow();
            var incStore = new IncrementStore();
            var decStore = new DecrementStore();

            var extensions = new object[] { incStore, decStore };

            dynamic innerInput = new WorkflowArguments();
            innerInput.Num = 3;

            dynamic input = new WorkflowArguments();
            input.Input = innerInput;
            input.Path = "ChildWithExtensions.xaml";
            input.Extensions = extensions;
            input.LocalAssembly = Assembly.GetExecutingAssembly();

            var host = WorkflowInvokerTest.Create(target);

            try
            {
                host.TestActivity(input);
                Assert.AreEqual(4, incStore.Value);
                Assert.AreEqual(2, decStore.Value);
            }
            finally
            {
                host.Tracking.Trace();
            }
        }