Add project files.

This commit is contained in:
2025-08-18 17:11:43 +03:30
parent 807dc263be
commit e5eb10d604
3943 changed files with 223719 additions and 0 deletions
@@ -0,0 +1,34 @@
using Elsa.Workflows.Activities;
using Elsa.Workflows.Runtime.Activities;
namespace Elsa.Workflows.IntegrationTests.Activities;
public class FinishForkedWorkflow : WorkflowBase
{
protected override void Build(IWorkflowBuilder workflow)
{
workflow.Root = new Fork
{
JoinMode = ForkJoinMode.WaitAll,
Branches =
{
new Sequence
{
Activities =
{
new WriteLine("Branch 1"),
new Event("Event 1")
}
},
new Sequence
{
Activities =
{
new WriteLine("Branch 2"),
new Finish()
}
}
}
};
}
}
@@ -0,0 +1,19 @@
using Elsa.Workflows.Activities;
namespace Elsa.Workflows.IntegrationTests.Activities;
public class FinishSequentialWorkflow : WorkflowBase
{
protected override void Build(IWorkflowBuilder workflow)
{
workflow.Root = new Sequence
{
Activities =
{
new WriteLine("Line 1"),
new Finish(),
new WriteLine("Line 2")
}
};
}
}
@@ -0,0 +1,45 @@
using Elsa.Testing.Shared;
using Microsoft.Extensions.DependencyInjection;
using Xunit.Abstractions;
namespace Elsa.Workflows.IntegrationTests.Activities;
public class FinishTests
{
private readonly IWorkflowRunner _workflowRunner;
private readonly CapturingTextWriter _capturingTextWriter = new();
private readonly IServiceProvider _services;
public FinishTests(ITestOutputHelper testOutputHelper)
{
_services = new TestApplicationBuilder(testOutputHelper).WithCapturingTextWriter(_capturingTextWriter).Build();
_workflowRunner = _services.GetRequiredService<IWorkflowRunner>();
}
[Fact(DisplayName = "Subsequent activities are not executed")]
public async Task Test1()
{
await _services.PopulateRegistriesAsync();
await _workflowRunner.RunAsync<FinishSequentialWorkflow>();
var lines = _capturingTextWriter.Lines.ToList();
Assert.Equal(new[] { "Line 1" }, lines);
}
[Fact(DisplayName = "Workflow status is set to Finished")]
public async Task Test2()
{
await _services.PopulateRegistriesAsync();
var result = await _workflowRunner.RunAsync<FinishSequentialWorkflow>();
var workflowState = result.WorkflowState;
Assert.Equal(WorkflowStatus.Finished, workflowState.Status);
Assert.Equal(WorkflowSubStatus.Finished, workflowState.SubStatus);
}
[Fact(DisplayName = "All bookmarks are removed")]
public async Task Test3()
{
await _services.PopulateRegistriesAsync();
var result = await _workflowRunner.RunAsync<FinishSequentialWorkflow>();
Assert.Empty(result.WorkflowState.Bookmarks);
}
}