< 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    {
 3719        builder.WithDefinitionId(WorkflowDefinitionId);
 3720        builder.AsSystemWorkflow();
 3721        var plan = builder.WithInput<AlterationPlanParams>("Plan", "The parameters for the new plan");
 3722        var planId = builder.WithVariable<string>();
 3723        var jobCount = builder.WithVariable<int>();
 24
 3725        builder.Root = new Sequence
 3726        {
 3727            Activities =
 3728            {
 3729                new SubmitAlterationPlan
 3730                {
 031                    Params = new(context => context.GetInput<AlterationPlanParams>(plan)!),
 3732                    Result = new(planId)
 3733                },
 3734                new Correlate(planId),
 3735                new GenerateAlterationJobs(planId)
 3736                {
 3737                    Result = new(jobCount)
 3738                },
 039                new If(context => jobCount.Get(context) > 0)
 3740                {
 3741                    Then = new DispatchAlterationJobs(planId),
 3742                    Else = new CompleteAlterationPlan(planId)
 3743                },
 3744                new AlterationPlanCompleted(planId),
 3745            }
 3746        };
 3747    }
 48}