< Summary

Information
Class: Elsa.Alterations.Activities.AlterationPlanCompleted
Assembly: Elsa.Alterations
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Alterations/Activities/AlterationPlanCompleted.cs
Line coverage
26%
Covered lines: 4
Uncovered lines: 11
Coverable lines: 15
Total lines: 55
Line coverage: 26.6%
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%
GetTriggerPayload(...)100%210%

File(s)

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

#LineLine coverage
 1using System.ComponentModel;
 2using System.Runtime.CompilerServices;
 3using Elsa.Alterations.Bookmarks;
 4using Elsa.Extensions;
 5using Elsa.Workflows;
 6using Elsa.Workflows.Attributes;
 7using Elsa.Workflows.Memory;
 8using Elsa.Workflows.Models;
 9
 10namespace Elsa.Alterations.Activities;
 11
 12/// <summary>
 13/// Submits an alteration plan for execution.
 14/// </summary>
 15[Browsable(false)]
 16[Activity("Elsa", "Alterations", "Triggered when an Alteration Plan completed")]
 17public class AlterationPlanCompleted : Trigger
 18{
 19    /// <inheritdoc />
 1920    public AlterationPlanCompleted(Variable<string> planId, [CallerFilePath] string? source = null, [CallerLineNumber] i
 21    {
 1922        PlanId = new Input<string>(planId);
 1923    }
 24
 25    /// <inheritdoc />
 026    public AlterationPlanCompleted([CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(s
 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        if (context.IsTriggerOfWorkflow())
 39        {
 040            await context.CompleteActivityAsync();
 041            return;
 42        }
 43
 044        var planId = context.Get(PlanId)!;
 045        var bookmarkPayload = new AlterationPlanCompletedPayload(planId);
 046        context.CreateBookmark(bookmarkPayload, false);
 047    }
 48
 49    /// <inheritdoc />
 50    protected override object GetTriggerPayload(TriggerIndexingContext context)
 51    {
 052        var planId = context.Get(PlanId)!;
 053        return new AlterationPlanCompletedPayload(planId);
 54    }
 55}