elsa-core/test/Elsa.IntegrationTests/WorkflowInvoker/Tests.cs
Sipke Schoorstra fccf4737e2
V3 modular configuration (#3070)
* Restructuring (WIP)

* Fix warnings

* Move DSL to modules

* Update namespaces

* Make design factory base reusable

* Update service registrations

* Remove unused namespaces and rename ElsaDbContext

* Incremental work on migrations

* Generate WorkflowsDbContext SQLite migrations

* Rename ServiceCollectionExtensions

* Update DbContextOptionsBuilderExtensions.cs

* Restructure

* Configuration refactorings (WIP)

* Incremental work on configurator API

* Incremental work on configuration API

* Incremental work on configuration API

* Fix workflow runtime options

* Move standard stream providers

* Implement configurator dependencies

* Cleanup configurator API

* Update configurator dependencies

* Cleanup

* Update Label API endpoints

* Fix eager configuration issue
2022-05-26 12:47:31 +02:00

48 lines
1.9 KiB
C#

using System.Threading.Tasks;
using Elsa.Extensions;
using Elsa.IntegrationTests.Scenarios.Persistence;
using Elsa.Persistence.Common.Implementations;
using Elsa.Testing.Shared;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Builders;
using Elsa.Workflows.Core.Pipelines.WorkflowExecution.Components;
using Elsa.Workflows.Persistence.Entities;
using Elsa.Workflows.Runtime.Extensions;
using Elsa.Workflows.Runtime.Services;
using Microsoft.Extensions.DependencyInjection;
using Xunit;
using Xunit.Abstractions;
namespace Elsa.IntegrationTests.WorkflowInvoker;
public class Tests
{
private readonly IWorkflowInvoker _workflowInvoker;
private readonly CapturingTextWriter _capturingTextWriter = new();
private readonly MemoryStore<WorkflowInstance> _workflowInstanceStore;
private readonly MemoryStore<WorkflowBookmark> _workflowBookmarkStore;
public Tests(ITestOutputHelper testOutputHelper)
{
var services = new TestApplicationBuilder(testOutputHelper).WithCapturingTextWriter(_capturingTextWriter).Build();
_workflowInvoker = services.GetRequiredService<IWorkflowInvoker>();
_workflowInstanceStore = services.GetRequiredService<MemoryStore<WorkflowInstance>>();
_workflowBookmarkStore = services.GetRequiredService<MemoryStore<WorkflowBookmark>>();
services.ConfigureDefaultWorkflowExecutionPipeline(pipeline => pipeline
.UsePersistence()
.UseStackBasedActivityScheduler());
}
[Fact(DisplayName = "Invoker creates workflow instance")]
public Task Test1()
{
var workflow = new WorkflowDefinitionBuilder().BuildWorkflowAsync<SequentialWorkflow>();
return Task.CompletedTask;
//var requ
//var result = await _workflowInvoker.InvokeAsync(new InvokeWorkflowDefinitionRequest());
//var workflowInstance = _workflowInstanceStore.Find(x => x.Id == result.WorkflowState.Id);
//Assert.NotNull(workflowInstance);
}
}