Beispiel #1
0
        public void RunTest()
        {
            Sequence workflow = new Sequence
            {
                Activities =
                {
                    new InvokeMyWorkflowExtensionActivity()
                }
            };

            _completedEvent = new AutoResetEvent(false);
            MyWorkflowExtension myExtension = new MyWorkflowExtension();

            WorkflowApplication wfApp = new WorkflowApplication(workflow);

            wfApp.Completed = delegate(WorkflowApplicationCompletedEventArgs e)
            {
                _terminationException = e.TerminationException;
                _completedEvent.Set();
            };
            wfApp.Extensions.Add(myExtension);

            Assert.True(!myExtension.ExtensionMethodInvoked);

            wfApp.Run();

            _completedEvent.WaitOne(TimeSpan.FromSeconds(2));

            Assert.True(myExtension.ExtensionMethodInvoked);
        }
Beispiel #2
0
        protected override void Execute(NativeActivityContext context)
        {
            MyWorkflowExtension myExtension = context.GetExtension <MyWorkflowExtension>();

            if (myExtension != null)
            {
                myExtension.ExtensionMethod();
            }
        }