< Summary

Information
Class: Elsa.Workflows.Activities.Correlate
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Activities/Correlate.cs
Line coverage
100%
Covered lines: 15
Uncovered lines: 0
Coverable lines: 15
Total lines: 53
Line coverage: 100%
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
.ctor(...)100%11100%
.ctor(...)100%11100%
.ctor(...)100%11100%
.ctor(...)100%11100%
get_CorrelationId()100%11100%
Execute(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Activities/Correlate.cs

#LineLine coverage
 1using System.ComponentModel;
 2using System.Runtime.CompilerServices;
 3using Elsa.Expressions.Models;
 4using Elsa.Workflows.Attributes;
 5using Elsa.Workflows.Memory;
 6using Elsa.Workflows.Models;
 7using JetBrains.Annotations;
 8
 9namespace Elsa.Workflows.Activities;
 10
 11/// <summary>
 12/// Set the CorrelationId of the workflow to a given value.
 13/// </summary>
 14[Activity("Elsa", "Primitives", "Set the CorrelationId of the workflow to a given value.")]
 15[PublicAPI]
 16public class Correlate : CodeActivity
 17{
 18    /// <inheritdoc />
 4019    public Correlate([CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(source, line)
 20    {
 4021    }
 22
 23    /// <inheritdoc />
 224    public Correlate(string correlationId, [CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) 
 25    {
 226        CorrelationId = new(correlationId);
 227    }
 28
 29    /// <inheritdoc />
 1630    public Correlate(Variable<string> correlationId, [CallerFilePath] string? source = null, [CallerLineNumber] int? lin
 31    {
 1632        CorrelationId = new(correlationId);
 1633    }
 34
 35    /// <inheritdoc />
 136    public Correlate(Func<ExpressionExecutionContext, string> correlationId, [CallerFilePath] string? source = null, [Ca
 37    {
 138        CorrelationId = new(correlationId);
 139    }
 40
 41    /// <summary>
 42    /// The correlation ID to set.
 43    /// </summary>
 44    [Description("An expression that evaluates to the value to store as the correlation id")]
 18145    public Input<string> CorrelationId { get; set; } = null!;
 46
 47    /// <inheritdoc />
 48    protected override void Execute(ActivityExecutionContext context)
 49    {
 550        var correlationId = context.Get(CorrelationId);
 551        context.WorkflowExecutionContext.CorrelationId = correlationId;
 552    }
 53}