2022-04-20 13:52:51 +00:00
|
|
|
using System;
|
2022-05-26 10:47:31 +00:00
|
|
|
using Elsa.Workflows.Core.Activities;
|
|
|
|
|
using Elsa.Workflows.Core.Services;
|
2022-04-20 13:52:51 +00:00
|
|
|
|
|
|
|
|
namespace Elsa.IntegrationTests.Activities;
|
|
|
|
|
|
2022-04-30 09:10:08 +00:00
|
|
|
public class ComplexIfWorkflow : WorkflowBase
|
2022-04-20 13:52:51 +00:00
|
|
|
{
|
|
|
|
|
private readonly Func<bool> _condition;
|
|
|
|
|
|
|
|
|
|
public ComplexIfWorkflow(Func<bool> condition)
|
|
|
|
|
{
|
|
|
|
|
_condition = condition;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-25 11:45:35 +00:00
|
|
|
protected override void Build(IWorkflowBuilder workflow)
|
2022-04-20 13:52:51 +00:00
|
|
|
{
|
2023-01-01 17:02:38 +00:00
|
|
|
workflow.Root = new Sequence
|
2022-04-20 13:52:51 +00:00
|
|
|
{
|
|
|
|
|
Activities =
|
|
|
|
|
{
|
|
|
|
|
new WriteLine("Start"),
|
2022-04-25 09:43:23 +00:00
|
|
|
new If(_condition)
|
2022-04-20 13:52:51 +00:00
|
|
|
{
|
2022-12-07 20:05:24 +00:00
|
|
|
Then = new Sequence
|
|
|
|
|
{
|
|
|
|
|
Activities =
|
|
|
|
|
{
|
|
|
|
|
new WriteLine("Executing"),
|
|
|
|
|
new WriteLine("True!")
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
Else = new Sequence
|
|
|
|
|
{
|
|
|
|
|
Activities =
|
|
|
|
|
{
|
|
|
|
|
new WriteLine("Executing"),
|
|
|
|
|
new WriteLine("False!")
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-04-20 13:52:51 +00:00
|
|
|
},
|
|
|
|
|
new WriteLine("End")
|
|
|
|
|
}
|
2023-01-01 17:02:38 +00:00
|
|
|
};
|
2022-04-20 13:52:51 +00:00
|
|
|
}
|
|
|
|
|
}
|