< Summary

Information
Class: Elsa.Workflows.Management.Models.WorkflowInstanceId
Assembly: Elsa.Workflows.Management
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Models/WorkflowInstanceId.cs
Line coverage
55%
Covered lines: 5
Uncovered lines: 4
Coverable lines: 9
Total lines: 37
Line coverage: 55.5%
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
get_Id()100%11100%
FromInstance(...)100%210%
FromInstanceExpression()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Models/WorkflowInstanceId.cs

#LineLine coverage
 1using System.Linq.Expressions;
 2using Elsa.Workflows.Management.Entities;
 3
 4namespace Elsa.Workflows.Management.Models;
 5
 6/// <summary>
 7/// Represents a workflow instance ID.
 8/// </summary>
 9public class WorkflowInstanceId
 10{
 11    /// <summary>
 12    /// The ID of the workflow instance.
 13    /// </summary>
 414    public string Id { get; set; } = default!;
 15
 16    /// <summary>
 17    /// Returns a model representing the workflow instance ID of the specified <see cref="WorkflowInstance"/>.
 18    /// </summary>
 19    public static WorkflowInstanceId FromInstance(WorkflowInstance workflowInstance)
 20    {
 021        return new()
 022        {
 023            Id = workflowInstance.Id
 024        };
 25    }
 26
 27    /// <summary>
 28    /// Returns a model representing the workflow instance ID of the specified <see cref="WorkflowInstance"/>.
 29    /// </summary>
 30    public static Expression<Func<WorkflowInstance, WorkflowInstanceId>> FromInstanceExpression()
 31    {
 232        return workflowInstance => new()
 233        {
 234            Id = workflowInstance.Id
 235        };
 36    }
 37}