< 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    {
 1919        builder.WithDefinitionId(WorkflowDefinitionId);
 1920        builder.AsSystemWorkflow();
 1921        var plan = builder.WithInput<AlterationPlanParams>("Plan", "The parameters for the new plan");
 1922        var planId = builder.WithVariable<string>();
 1923        var jobCount = builder.WithVariable<int>();
 24
 1925        builder.Root = new Sequence
 1926        {
 1927            Activities =
 1928            {
 1929                new SubmitAlterationPlan
 1930                {
 031                    Params = new(context => context.GetInput<AlterationPlanParams>(plan)!),
 1932                    Result = new(planId)
 1933                },
 1934                new Correlate(planId),
 1935                new GenerateAlterationJobs(planId)
 1936                {
 1937                    Result = new(jobCount)
 1938                },
 039                new If(context => jobCount.Get(context) > 0)
 1940                {
 1941                    Then = new DispatchAlterationJobs(planId),
 1942                    Else = new CompleteAlterationPlan(planId)
 1943                },
 1944                new AlterationPlanCompleted(planId),
 1945            }
 1946        };
 1947    }
 48}