< Summary

Information
Class: Elsa.Workflows.Runtime.WorkflowMatcher
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Services/WorkflowMatcher.cs
Line coverage
15%
Covered lines: 3
Uncovered lines: 17
Coverable lines: 20
Total lines: 47
Line coverage: 15%
Branch coverage
0%
Covered branches: 0
Total branches: 10
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
FindTriggersAsync(...)100%210%
FindTriggersAsync()100%11100%
FindBookmarksAsync(...)0%620%
FindBookmarksAsync()0%7280%

File(s)

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

#LineLine coverage
 1using Elsa.Workflows.Runtime.Entities;
 2using Elsa.Workflows.Runtime.Extensions;
 3using Elsa.Workflows.Runtime.Filters;
 4using Elsa.Workflows.Runtime.Options;
 5
 6namespace Elsa.Workflows.Runtime;
 7
 8/// <inheritdoc />
 579public class WorkflowMatcher(IStimulusHasher stimulusHasher, ITriggerStore triggerStore, IBookmarkStore bookmarkStore) :
 10{
 11    /// <inheritdoc />
 12    public Task<IEnumerable<StoredTrigger>> FindTriggersAsync(string activityTypeName, object stimulus, CancellationToke
 13    {
 014        var hash = stimulusHasher.Hash(activityTypeName, stimulus);
 015        return FindTriggersAsync(hash, cancellationToken);
 16    }
 17
 18    /// <inheritdoc />
 19    public async Task<IEnumerable<StoredTrigger>> FindTriggersAsync(string stimulusHash, CancellationToken cancellationT
 20    {
 521        return await triggerStore.FindManyByStimulusHashAsync(stimulusHash, cancellationToken);
 522    }
 23
 24    /// <inheritdoc />
 25    public Task<IEnumerable<StoredBookmark>> FindBookmarksAsync(string activityTypeName, object stimulus, FindBookmarkOp
 26    {
 027        var hash = stimulusHasher.Hash(activityTypeName, stimulus, options?.ActivityInstanceId);
 028        return FindBookmarksAsync(hash, options, cancellationToken);
 29    }
 30
 31    /// <inheritdoc />
 32    public async Task<IEnumerable<StoredBookmark>> FindBookmarksAsync(string stimulusHash, FindBookmarkOptions? options 
 33    {
 034        var correlationId = options?.CorrelationId;
 035        var workflowInstanceId = options?.WorkflowInstanceId;
 036        var activityInstanceId = options?.ActivityInstanceId;
 037        var filter = new BookmarkFilter
 038        {
 039            Hash = stimulusHash,
 040            CorrelationId = correlationId,
 041            WorkflowInstanceId = workflowInstanceId,
 042            ActivityInstanceId = activityInstanceId,
 043            BookmarkId = options?.BookmarkId
 044        };
 045        return await bookmarkStore.FindManyAsync(filter, cancellationToken);
 046    }
 47}