< Summary

Information
Class: Elsa.Workflows.CodeActivity<T>
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Abstractions/CodeActivity.cs
Line coverage
23%
Covered lines: 3
Uncovered lines: 10
Coverable lines: 13
Total lines: 100
Line coverage: 23%
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%
.ctor(...)0%620%
.ctor(...)100%210%
get_Result()100%11100%
Elsa.Workflows.IActivityWithResult.get_Result()100%210%
Elsa.Workflows.IActivityWithResult.set_Result(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Abstractions/CodeActivity.cs

#LineLine coverage
 1using Elsa.Expressions.Models;
 2using Elsa.Extensions;
 3using Elsa.Workflows.Attributes;
 4using Elsa.Workflows.Behaviors;
 5using Elsa.Workflows.Models;
 6using JetBrains.Annotations;
 7
 8namespace Elsa.Workflows;
 9
 10/// <summary>
 11/// Base class for custom activities with auto-complete behavior.
 12/// </summary>
 13[PublicAPI]
 14public abstract class CodeActivity : Activity
 15{
 16    /// <inheritdoc />
 17    protected CodeActivity(string? source = default, int? line = default) : base(source, line)
 18    {
 19        Behaviors.Add<AutoCompleteBehavior>(this);
 20    }
 21
 22    /// <inheritdoc />
 23    protected CodeActivity(string activityType, int version = 1, string? source = default, int? line = default) : base(a
 24    {
 25        Type = activityType;
 26    }
 27}
 28
 29/// <summary>
 30/// Base class for custom activities with auto-complete behavior that return a result.
 31/// </summary>
 32[PublicAPI]
 33public abstract class CodeActivityWithResult : CodeActivity
 34{
 35    /// <inheritdoc />
 36    protected CodeActivityWithResult(string? source = default, int? line = default) : base(source, line)
 37    {
 38    }
 39
 40    /// <inheritdoc />
 41    protected CodeActivityWithResult(string activityType, int version = 1, string? source = default, int? line = default
 42    {
 43    }
 44
 45    /// <inheritdoc />
 46    protected CodeActivityWithResult(MemoryBlockReference? output, string? source = default, int? line = default) : base
 47    {
 48        if (output != null) Result = new Output(output);
 49    }
 50
 51    /// <inheritdoc />
 52    protected CodeActivityWithResult(Output? output, string? source = default, int? line = default) : base(source, line)
 53    {
 54        Result = output;
 55    }
 56
 57    /// <summary>
 58    /// The result of the activity.
 59    /// </summary>
 60    public Output? Result { get; set; }
 61}
 62
 63/// <summary>
 64/// Base class for custom activities with auto-complete behavior that return a result.
 65/// </summary>
 66public abstract class CodeActivity<T> : CodeActivity, IActivityWithResult<T>
 67{
 68    /// <inheritdoc />
 9469    protected CodeActivity(string? source = default, int? line = default) : base(source, line)
 70    {
 9471    }
 72
 73    /// <inheritdoc />
 074    protected CodeActivity(string activityType, int version = 1, string? source = default, int? line = default) : base(a
 75    {
 076    }
 77
 78    /// <inheritdoc />
 079    protected CodeActivity(MemoryBlockReference? output, string? source = default, int? line = default) : this(source, l
 80    {
 081        if (output != null) Result = new Output<T>(output);
 082    }
 83
 84    /// <inheritdoc />
 085    protected CodeActivity(Output<T>? output, string? source = default, int? line = default) : this(source, line)
 86    {
 087        Result = output;
 088    }
 89
 90    /// <summary>
 91    /// The result of the activity.
 92    /// </summary>
 26393    [Output] public Output<T>? Result { get; set; }
 94
 95    Output? IActivityWithResult.Result
 96    {
 097        get => Result;
 098        set => Result = (Output<T>?)value;
 99    }
 100}