- Introduced `EndInFlowchartWorkflow` and `EndInSequenceWorkflow` to test `End` activity behavior in flowcharts and sequences. - Added `EndTests` integration and unit tests to verify correct termination behavior, including `ITerminalNode` implementation. - Updated flowchart logic to handle terminal nodes, ensuring immediate flowchart completion upon encountering `End`.
36 lines
872 B
C#
36 lines
872 B
C#
using Elsa.Testing.Shared;
|
|
using Elsa.Workflows;
|
|
using Elsa.Workflows.Activities;
|
|
|
|
namespace Elsa.Activities.UnitTests.Flow;
|
|
|
|
/// <summary>
|
|
/// Unit tests for the <see cref="End"/> activity.
|
|
/// </summary>
|
|
public class EndTests
|
|
{
|
|
[Fact(DisplayName = "End implements ITerminalNode interface")]
|
|
public void End_ImplementsITerminalNode()
|
|
{
|
|
// Arrange
|
|
var endActivity = new End();
|
|
|
|
// Assert
|
|
Assert.IsAssignableFrom<ITerminalNode>(endActivity);
|
|
}
|
|
|
|
[Fact(DisplayName = "End completes execution")]
|
|
public async Task End_CompletesExecution()
|
|
{
|
|
// Arrange
|
|
var endActivity = new End();
|
|
var fixture = new ActivityTestFixture(endActivity);
|
|
|
|
// Act
|
|
var context = await fixture.ExecuteAsync();
|
|
|
|
// Assert
|
|
Assert.Equal(ActivityStatus.Completed, context.Status);
|
|
}
|
|
}
|