Beispiel #1
0
        public async Task Test02(string signal)
        {
            var workflow          = new ForkJoinWorkflow(Join.JoinMode.WaitAny);
            var workflowBlueprint = WorkflowBuilder.Build(workflow);
            var workflowResult    = await WorkflowStarter.StartWorkflowAsync(workflowBlueprint);

            var workflowInstance = workflowResult.WorkflowInstance !;

            async Task <bool> GetActivityHasExecutedAsync(string name)
            {
                var activity = workflowBlueprint !.Activities.First(x => x.Name == name);
                var entry    = await WorkflowExecutionLog.FindEntryAsync(new ActivityIdSpecification(activity.Id));

                return(entry != null);
            }

            Task <bool> GetIsFinishedAsync() => GetActivityHasExecutedAsync("Finished");

            Assert.Equal(WorkflowStatus.Suspended, workflowInstance.WorkflowStatus);
            Assert.False(await GetIsFinishedAsync());

            // Trigger signal.
            workflowInstance = await TriggerSignalAsync(workflowBlueprint, workflowInstance, signal);

            Assert.Equal(WorkflowStatus.Finished, workflowInstance.WorkflowStatus);
            Assert.True(await GetIsFinishedAsync());
        }
Beispiel #2
0
        public async Task Test04()
        {
            var workflow          = new ForkEagerJoinWorkflow(true);
            var workflowBlueprint = WorkflowBuilder.Build(workflow);
            var workflowResult    = await WorkflowStarter.StartWorkflowAsync(workflowBlueprint);

            var workflowInstance = workflowResult.WorkflowInstance !;

            Assert.Single(workflowInstance.BlockingActivities);
        }
Beispiel #3
0
        public async Task Test03()
        {
            var workflow          = new ForkEagerJoinWorkflow(false);
            var workflowBlueprint = WorkflowBuilder.Build(workflow);
            var workflowResult    = await WorkflowStarter.StartWorkflowAsync(workflowBlueprint);

            var workflowInstance = workflowResult.WorkflowInstance !;

            Assert.Equal(2, workflowInstance.BlockingActivities.Count);
        }
Beispiel #4
0
        public void BuildShouldReturnWorkflowBlueprintWithWorkflowBurstPersistenceBehaviourIfNoBehaviourSpecified([WithAutofixtureResolution, Frozen] IServiceProvider serviceProvider,
                                                                                                                  IIdGenerator idGenerator,
                                                                                                                  IGetsStartActivities getsStartActivities,
                                                                                                                  string idPrefix)
        {
            var workflow  = new NoOpWorkflow();
            var sut       = new WorkflowBuilder(idGenerator, serviceProvider, getsStartActivities);
            var blueprint = sut.Build(workflow, idPrefix);

            Assert.Equal(WorkflowPersistenceBehavior.WorkflowBurst, blueprint.PersistenceBehavior);
        }
Beispiel #5
0
 public void Build()
 {
     WorkflowContainer        = WorkflowBuilder.Build();
     WorkflowContainerManager = new ContainerManager(WorkflowContainer);
 }