< Summary

Information
Class: Elsa.Alterations.Activities.CompleteAlterationPlan
Assembly: Elsa.Alterations
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Alterations/Activities/CompleteAlterationPlan.cs
Line coverage
28%
Covered lines: 4
Uncovered lines: 10
Coverable lines: 14
Total lines: 48
Line coverage: 28.5%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
.ctor(...)100%210%
get_PlanId()100%11100%
ExecuteAsync()0%620%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Alterations/Activities/CompleteAlterationPlan.cs

#LineLine coverage
 1using System.ComponentModel;
 2using System.Runtime.CompilerServices;
 3using Elsa.Alterations.Core.Contracts;
 4using Elsa.Workflows;
 5using Elsa.Workflows.Attributes;
 6using Elsa.Workflows.Exceptions;
 7using Elsa.Workflows.Memory;
 8using Elsa.Workflows.Models;
 9
 10namespace Elsa.Alterations.Activities;
 11
 12/// <summary>
 13/// Marks an alteration plan as completed.
 14/// </summary>
 15[Browsable(false)]
 16[Activity("Elsa", "Alterations", "Dispatches jobs for the specified Alteration Plan", Kind = ActivityKind.Task)]
 17public class CompleteAlterationPlan : CodeActivity
 18{
 19    /// <inheritdoc />
 1920    public CompleteAlterationPlan(Variable<string> planId, [CallerFilePath] string? source = null, [CallerLineNumber] in
 21    {
 1922        PlanId = new Input<string>(planId);
 1923    }
 24
 25    /// <inheritdoc />
 026    public CompleteAlterationPlan([CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(so
 27    {
 028    }
 29
 30    /// <summary>
 31    /// The ID of the alteration plan.
 32    /// </summary>
 6733    public Input<string> PlanId { get; set; } = null!;
 34
 35    /// <inheritdoc />
 36    protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
 37    {
 038        var cancellationToken = context.CancellationToken;
 039        var planId = context.Get(PlanId)!;
 040        var manager = context.GetRequiredService<IAlterationPlanManager>();
 041        var plan = await manager.GetPlanAsync(planId, cancellationToken);
 42
 043        if (plan == null)
 044            throw new FaultException(AlterationFaultCodes.PlanNotFound, AlterationFaultCategories.Alteration, DefaultFau
 45
 046        await manager.CompletePlanAsync(plan, cancellationToken);
 047    }
 48}