< Summary

Information
Class: Elsa.Alterations.Workflows.ExecuteAlterationPlanWorkflow
Assembly: Elsa.Alterations
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Alterations/Workflows/ExecuteAlterationPlanWorkflow.cs
Line coverage
92%
Covered lines: 26
Uncovered lines: 2
Coverable lines: 28
Total lines: 48
Line coverage: 92.8%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Build(...)100%1192.85%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Alterations/Workflows/ExecuteAlterationPlanWorkflow.cs

#LineLine coverage
 1using Elsa.Alterations.Activities;
 2using Elsa.Alterations.Core.Models;
 3using Elsa.Extensions;
 4using Elsa.Workflows;
 5using Elsa.Workflows.Activities;
 6
 7namespace Elsa.Alterations.Workflows;
 8
 9/// <summary>
 10/// Executes an alteration plan.
 11/// </summary>
 12public class ExecuteAlterationPlanWorkflow : WorkflowBase
 13{
 14    internal const string WorkflowDefinitionId = "Elsa.Alterations.ExecuteAlterationPlan";
 15
 16    /// <inheritdoc />
 17    protected override void Build(IWorkflowBuilder builder)
 18    {
 7919        builder.WithDefinitionId(WorkflowDefinitionId);
 7920        builder.AsSystemWorkflow();
 7921        var plan = builder.WithInput<AlterationPlanParams>("Plan", "The parameters for the new plan");
 7922        var planId = builder.WithVariable<string>();
 7923        var jobCount = builder.WithVariable<int>();
 24
 7925        builder.Root = new Sequence
 7926        {
 7927            Activities =
 7928            {
 7929                new SubmitAlterationPlan
 7930                {
 031                    Params = new(context => context.GetInput<AlterationPlanParams>(plan)!),
 7932                    Result = new(planId)
 7933                },
 7934                new Correlate(planId),
 7935                new GenerateAlterationJobs(planId)
 7936                {
 7937                    Result = new(jobCount)
 7938                },
 039                new If(context => jobCount.Get(context) > 0)
 7940                {
 7941                    Then = new DispatchAlterationJobs(planId),
 7942                    Else = new CompleteAlterationPlan(planId)
 7943                },
 7944                new AlterationPlanCompleted(planId),
 7945            }
 7946        };
 7947    }
 48}