elsa-core/test/Elsa.IntegrationTests/Activities/Break/BreakWhileWorkflow.cs
Sipke Schoorstra 261c9cb1a5
Implement Default Workflow Invoker (#2979)
* Implement default invoker

* Proto actor improvements

* Refactor workflow registry handling

* Update migrations
2022-04-30 11:10:08 +02:00

40 lines
1.2 KiB
C#

using Elsa.Activities;
using Elsa.Models;
using Elsa.Modules.Activities.Console;
using Elsa.Services;
namespace Elsa.IntegrationTests.Activities;
public class BreakWhileWorkflow : WorkflowBase
{
protected override void Build(IWorkflowDefinitionBuilder workflow)
{
var currentValue = new Variable<int?>(0);
workflow.WithRoot(new Sequence
{
Variables = { currentValue },
Activities =
{
new WriteLine("Start"),
While.True(new Sequence
{
Activities =
{
new SetVariable
{
Variable = currentValue,
Value = new Input<object?>(context => currentValue.Get(context) + 1)
},
new If(context => currentValue.Get(context) == 3)
{
Then = new Break()
},
new WriteLine(context => currentValue.Get(context).ToString()),
}
}),
new WriteLine("End"),
}
});
}
}