< Summary

Information
Class: Elsa.Workflows.CodeActivityWithResult
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Abstractions/CodeActivity.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 11
Coverable lines: 11
Total lines: 100
Line coverage: 0%
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%210%
.ctor(...)100%210%
.ctor(...)0%620%
.ctor(...)100%210%
get_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 />
 036    protected CodeActivityWithResult(string? source = default, int? line = default) : base(source, line)
 37    {
 038    }
 39
 40    /// <inheritdoc />
 041    protected CodeActivityWithResult(string activityType, int version = 1, string? source = default, int? line = default
 42    {
 043    }
 44
 45    /// <inheritdoc />
 046    protected CodeActivityWithResult(MemoryBlockReference? output, string? source = default, int? line = default) : base
 47    {
 048        if (output != null) Result = new Output(output);
 049    }
 50
 51    /// <inheritdoc />
 052    protected CodeActivityWithResult(Output? output, string? source = default, int? line = default) : base(source, line)
 53    {
 054        Result = output;
 055    }
 56
 57    /// <summary>
 58    /// The result of the activity.
 59    /// </summary>
 060    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 />
 69    protected CodeActivity(string? source = default, int? line = default) : base(source, line)
 70    {
 71    }
 72
 73    /// <inheritdoc />
 74    protected CodeActivity(string activityType, int version = 1, string? source = default, int? line = default) : base(a
 75    {
 76    }
 77
 78    /// <inheritdoc />
 79    protected CodeActivity(MemoryBlockReference? output, string? source = default, int? line = default) : this(source, l
 80    {
 81        if (output != null) Result = new Output<T>(output);
 82    }
 83
 84    /// <inheritdoc />
 85    protected CodeActivity(Output<T>? output, string? source = default, int? line = default) : this(source, line)
 86    {
 87        Result = output;
 88    }
 89
 90    /// <summary>
 91    /// The result of the activity.
 92    /// </summary>
 93    [Output] public Output<T>? Result { get; set; }
 94
 95    Output? IActivityWithResult.Result
 96    {
 97        get => Result;
 98        set => Result = (Output<T>?)value;
 99    }
 100}