* Incremental work on Telnyx integration * Incremental port of Telnyx activities * Fix polymorphic JSON serialization for webhook data * Fix IsFirstPass logic * Fix trigger base to prevent activity auto completion * Temporarily disable persistent snapshotting provider for testing * Fix namespaces * Add method to register activities in bulk using marker type * Fix Telnyx refit client setup * Register all Telnyx activities by default * Incremental work on webhook driven resumption and correlation * Incremental work on post-bookmark signaling * Fix bookmark resolution * Include correlation ID with bookmark * Fix Telnyx resumption input * Replace bookmark persisted signal with handler * Fix SpeakText completion * Add flow outcomes to SpeakText activity * Update GatherUsingSpeak and GatherUsingaudio * Refactor "is first pass" concept * Fix WebhookEvent activity * Add HTTP absolute URL provider * Formatting and small changes * Various API enhancements
45 lines
1.8 KiB
C#
45 lines
1.8 KiB
C#
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Elsa.Testing.Shared;
|
|
using Elsa.Workflows.Core;
|
|
using Elsa.Workflows.Core.Services;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Elsa.IntegrationTests.Scenarios.BlockingAndBreaking;
|
|
|
|
public class Tests
|
|
{
|
|
private readonly IWorkflowRunner _workflowRunner;
|
|
private readonly CapturingTextWriter _capturingTextWriter = new();
|
|
private readonly IWorkflowBuilderFactory _workflowBuilderFactory;
|
|
|
|
public Tests(ITestOutputHelper testOutputHelper)
|
|
{
|
|
var services = new TestApplicationBuilder(testOutputHelper).WithCapturingTextWriter(_capturingTextWriter).Build();
|
|
_workflowBuilderFactory = services.GetRequiredService<IWorkflowBuilderFactory>();
|
|
_workflowRunner = services.GetRequiredService<IWorkflowRunner>();
|
|
}
|
|
|
|
[Fact(DisplayName = "While loop blocks when bookmark is created")]
|
|
public async Task Test1()
|
|
{
|
|
var workflow = await _workflowBuilderFactory.CreateBuilder().BuildWorkflowAsync<BreakWhileBlockForkWorkflow>();
|
|
|
|
// Start workflow.
|
|
var result1 = await _workflowRunner.RunAsync(workflow);
|
|
|
|
// Resume one of the branches.
|
|
var bookmark = result1.WorkflowState.Bookmarks.FirstOrDefault(x => x.ActivityId == "Branch 1");
|
|
var runOptions = new RunWorkflowOptions(BookmarkId: bookmark!.Id);
|
|
var result2 = await _workflowRunner.RunAsync(workflow, result1.WorkflowState, runOptions);
|
|
|
|
// Assert that all bookmarks have been cleared.
|
|
Assert.Empty(result2.WorkflowState.Bookmarks);
|
|
|
|
// Verify expected output.
|
|
var lines = _capturingTextWriter.Lines.ToList();
|
|
Assert.Equal(new[] { "Branch 2", "Branch 1", "Branch 1 - Resumed" }, lines);
|
|
}
|
|
} |