Example #1
0
        public void TestTimeout( )
        {
            var dummyTimeoutHelper = new DummyTimeoutHelper();

            using (var scope = Factory.Current.BeginLifetimeScope(builder =>
            {
                builder.Register(ctx => dummyTimeoutHelper).As <ITimeoutActivityHelper>();
            }))
                using (Factory.SetCurrentScope(scope))
                {
                    Workflow displayFormWf = CreateDisplayFormTestWf(null, null, null, 5);

                    WorkflowRun run = RunWorkflow(displayFormWf);

                    dummyTimeoutHelper.Timeout();

                    run = Entity.Get <WorkflowRun>(run);

                    Assert.AreEqual(WorkflowRunState_Enumeration.WorkflowRunCompleted, run.WorkflowRunStatus_Enum);

                    var exitPoint = run.GetExitPoint();

                    Assert.AreEqual("Time-out", exitPoint.Name, "Workflow exited at a time-out");
                    // Need to figure out how to test the exit point.
                }
        }
Example #2
0
        public void NotifyWaitForReplies()
        {
            var dummyTimeoutHelper = new DummyTimeoutHelper();

            using (var scope = Factory.Current.BeginLifetimeScope(builder =>
            {
                builder.Register(ctx => dummyTimeoutHelper).As <ITimeoutActivityHelper>();
                builder.RegisterType <DummyNotifier>().As <INotifier>();
            }))
                using (Factory.SetCurrentScope(scope))
                {
                    var wf = CreateNotifyWorkflow(true);

                    var person = new Person {
                        Name = "bob",
                    };
                    person.SetField("shared:businessEmail", "*****@*****.**");

                    var inputs = new Dictionary <string, object>
                    {
                        { "People", person.ToEnumerable() },
                        { "Message", "Test" }
                    };

                    var run1 = (RunWorkflow(wf, inputs));

                    dummyTimeoutHelper.Timeout();

                    var run2 = Entity.Get <WorkflowRun>(run1.Id);
                    Assert.That(run2.WorkflowRunStatus_Enum, Is.EqualTo(WorkflowRunState_Enumeration.WorkflowRunCompleted));
                }
        }