< Summary

Information
Class: Elsa.Workflows.WorkflowIndexingContext
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Contexts/WorkflowIndexingContext.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 28
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_Workflow()100%11100%
get_Registers()100%11100%
get_CancellationToken()100%11100%
GetOrCreateRegister(...)100%22100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/Contexts/WorkflowIndexingContext.cs

#LineLine coverage
 1using Elsa.Expressions.Models;
 2using Elsa.Workflows.Activities;
 3
 4namespace Elsa.Workflows;
 5
 6public class WorkflowIndexingContext
 7{
 5288    public WorkflowIndexingContext(Workflow workflow, CancellationToken cancellationToken)
 9    {
 52810        Workflow = workflow;
 52811        CancellationToken = cancellationToken;
 52812    }
 13
 18314    public Workflow Workflow { get; }
 65015    public IDictionary<ITrigger, MemoryRegister> Registers { get; } = new Dictionary<ITrigger, MemoryRegister>();
 12216    public CancellationToken CancellationToken { get; }
 17
 18    public MemoryRegister GetOrCreateRegister(ITrigger activity)
 19    {
 6120        if (!Registers.TryGetValue(activity, out var register))
 21        {
 6122            register = Workflow.CreateRegister();
 6123            Registers[activity] = register;
 24        }
 25
 6126        return register;
 27    }
 28}