< Summary

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

File(s)

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

#LineLine coverage
 1using System.Runtime.CompilerServices;
 2using Elsa.Extensions;
 3using Elsa.Workflows.Attributes;
 4using Elsa.Workflows.Models;
 5using JetBrains.Annotations;
 6
 7namespace Elsa.Workflows.Activities;
 8
 9/// <summary>
 10/// Sets a property on the workflow execution context with the specified name value.
 11/// </summary>
 12[Activity("Elsa", "Primitives", "Set the name of the workflow instance to a specified value.")]
 13[PublicAPI]
 14public class SetName : CodeActivity
 15{
 16    /// <inheritdoc />
 2417    public SetName([CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : base(source, line)
 18    {
 2419    }
 20
 21    /// <inheritdoc />
 122    public SetName(Input<string> value, [CallerFilePath] string? source = null, [CallerLineNumber] int? line = null) : t
 23    {
 124        Value = value;
 125    }
 26
 27    /// <summary>
 28    /// The value to set the workflow instance's name to.
 29    /// </summary>
 10230    public Input<string> Value { get; set; } = new("");
 31
 32    /// <inheritdoc />
 33    protected override void Execute(ActivityExecutionContext context)
 34    {
 1135        var value = Value.GetOrDefault(context);
 1136        context.WorkflowExecutionContext.Name = value;
 1137    }
 38}