diff --git a/test/Elsa.IntegrationTests/Scenarios/BlockingAndBreaking/Tests.cs b/test/Elsa.IntegrationTests/Scenarios/BlockingAndBreaking/Tests.cs index a15cd2801..31955134e 100644 --- a/test/Elsa.IntegrationTests/Scenarios/BlockingAndBreaking/Tests.cs +++ b/test/Elsa.IntegrationTests/Scenarios/BlockingAndBreaking/Tests.cs @@ -26,10 +26,17 @@ public class Tests var workflow = new WorkflowDefinitionBuilder().BuildWorkflow(); // Start workflow. - await _workflowRunner.RunAsync(workflow); + var result1 = await _workflowRunner.RunAsync(workflow); + // Resume one of the branches. + var bookmark = result1.Bookmarks.FirstOrDefault(x => x.ActivityId == "Branch 1"); + var result2 = await _workflowRunner.RunAsync(workflow, result1.WorkflowState, bookmark); + + // Assert that all bookmarks have been cleared. + Assert.Empty(result2.Bookmarks); + // Verify expected output. var lines = _capturingTextWriter.Lines.ToList(); - Assert.Equal(new[] { "Current value: 0", "Branch 1", "Blocking Branch 2" }, lines); + Assert.Equal(new[] { "Branch 1", "Branch 2", "Branch 1 - Resumed" }, lines); } } \ No newline at end of file diff --git a/test/Elsa.IntegrationTests/Scenarios/BlockingAndBreaking/Workflows.cs b/test/Elsa.IntegrationTests/Scenarios/BlockingAndBreaking/Workflows.cs index 3310ab4cc..d0ed736b6 100644 --- a/test/Elsa.IntegrationTests/Scenarios/BlockingAndBreaking/Workflows.cs +++ b/test/Elsa.IntegrationTests/Scenarios/BlockingAndBreaking/Workflows.cs @@ -13,27 +13,34 @@ public class BreakWhileBlockForkWorkflow : IWorkflow var currentValue = new Variable(0); workflow.WithVariable(currentValue); - workflow.WithRoot(new While(context => currentValue.Get(context) < 3) + workflow.WithRoot(new While(() => true) { Body = new Sequence { Activities = { - new WriteLine(context => $"Current value: {currentValue.Get(context)}"), - new SetVariable(currentValue, context => currentValue.Get(context) + 1), new Fork { + JoinMode = JoinMode.WaitAll, Branches = { - new WriteLine("Branch 1"), + new Sequence{ + Activities = + { + new WriteLine("Branch 1"), + new Event("Branch 1") { Id = "Branch 1" }, + new WriteLine("Branch 1 - Resumed"), + new Break() + } + }, new Sequence { Activities = { - new WriteLine("Blocking Branch 2"), - new Event("Some event") { Id = "SomeEvent" }, - new WriteLine("Resuming Branch 2"), + new WriteLine("Branch 2"), + new Event("Branch 2") { Id = "Branch 2" }, + new WriteLine("Branch 2 - Resumed"), } } }