< Summary

Information
Class: Elsa.Workflows.Runtime.TriggerBoundWorkflowService
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Services/TriggerBoundWorkflowService.cs
Line coverage
75%
Covered lines: 15
Uncovered lines: 5
Coverable lines: 20
Total lines: 46
Line coverage: 75%
Branch coverage
75%
Covered branches: 3
Total branches: 4
Branch coverage: 75%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
FindManyAsync()100%210%
FindManyAsync()100%11100%
FindManyAsync()75%4483.33%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Services/TriggerBoundWorkflowService.cs

#LineLine coverage
 1using Elsa.Workflows.Management;
 2using Elsa.Workflows.Runtime.Entities;
 3using Microsoft.Extensions.Logging;
 4
 5namespace Elsa.Workflows.Runtime;
 6
 7/// <inheritdoc />
 578public class TriggerBoundWorkflowService(IWorkflowMatcher workflowMatcher, IWorkflowDefinitionService workflowDefinition
 9{
 10    /// <inheritdoc />
 11    public async Task<IEnumerable<TriggerBoundWorkflow>> FindManyAsync(string activityTypeName, object stimulus, Cancell
 12    {
 013        var triggers = await workflowMatcher.FindTriggersAsync(activityTypeName, stimulus, cancellationToken);
 014        return await FindManyAsync(triggers, cancellationToken);
 015    }
 16
 17    /// <inheritdoc />
 18    public async Task<IEnumerable<TriggerBoundWorkflow>> FindManyAsync(string stimulusHash, CancellationToken cancellati
 19    {
 520        var triggers = await workflowMatcher.FindTriggersAsync(stimulusHash, cancellationToken);
 521        return await FindManyAsync(triggers, cancellationToken);
 522    }
 23
 24    private async Task<IEnumerable<TriggerBoundWorkflow>> FindManyAsync(IEnumerable<StoredTrigger> triggers, Cancellatio
 25    {
 1026        var groupedTriggers = triggers.GroupBy(x => x.WorkflowDefinitionVersionId);
 527        var triggerBoundWorkflows = new List<TriggerBoundWorkflow>();
 28
 2029        foreach (var triggerGroup in groupedTriggers)
 30        {
 531            var workflowDefinitionVersionId = triggerGroup.Key;
 532            var workflowGraph = await workflowDefinitionService.FindWorkflowGraphAsync(workflowDefinitionVersionId, canc
 33
 534            if (workflowGraph == null)
 35            {
 036                logger.LogWarning("Workflow definition with ID {WorkflowDefinitionVersionId} not found", workflowDefinit
 037                continue;
 38            }
 39
 540            var triggerBoundWorkflow = new TriggerBoundWorkflow(workflowGraph, triggerGroup.ToList());
 541            triggerBoundWorkflows.Add(triggerBoundWorkflow);
 542        }
 43
 544        return triggerBoundWorkflows;
 545    }
 46}