< 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    {
 5919        builder.WithDefinitionId(WorkflowDefinitionId);
 5920        builder.AsSystemWorkflow();
 5921        var plan = builder.WithInput<AlterationPlanParams>("Plan", "The parameters for the new plan");
 5922        var planId = builder.WithVariable<string>();
 5923        var jobCount = builder.WithVariable<int>();
 24
 5925        builder.Root = new Sequence
 5926        {
 5927            Activities =
 5928            {
 5929                new SubmitAlterationPlan
 5930                {
 031                    Params = new(context => context.GetInput<AlterationPlanParams>(plan)!),
 5932                    Result = new(planId)
 5933                },
 5934                new Correlate(planId),
 5935                new GenerateAlterationJobs(planId)
 5936                {
 5937                    Result = new(jobCount)
 5938                },
 039                new If(context => jobCount.Get(context) > 0)
 5940                {
 5941                    Then = new DispatchAlterationJobs(planId),
 5942                    Else = new CompleteAlterationPlan(planId)
 5943                },
 5944                new AlterationPlanCompleted(planId),
 5945            }
 5946        };
 5947    }
 48}