< Summary

Information
Class: Elsa.Workflows.Runtime.BookmarkBoundWorkflowService
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Services/BookmarkBoundWorkflowService.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 14
Coverable lines: 14
Total lines: 38
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
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%210%
FindManyAsync()100%210%
FindManyAsync()100%210%
Map(...)0%620%

File(s)

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

#LineLine coverage
 1using Elsa.Workflows.Runtime.Entities;
 2using Elsa.Workflows.Runtime.Options;
 3
 4namespace Elsa.Workflows.Runtime;
 5
 6/// <inheritdoc />
 7[Obsolete("Will be removed in a future version.")]
 08public class BookmarkBoundWorkflowService(IWorkflowMatcher workflowMatcher) : IBookmarkBoundWorkflowService
 9{
 10    /// <inheritdoc />
 11    public async Task<IEnumerable<BookmarkBoundWorkflow>> FindManyAsync(string activityTypeName, object stimulus, FindBo
 12    {
 013        var bookmarks = await workflowMatcher.FindBookmarksAsync(activityTypeName, stimulus, options, cancellationToken)
 014        return Map(bookmarks);
 015    }
 16
 17    /// <inheritdoc />
 18    public async Task<IEnumerable<BookmarkBoundWorkflow>> FindManyAsync(string stimulusHash, FindBookmarkOptions? option
 19    {
 020        var bookmarks = await workflowMatcher.FindBookmarksAsync(stimulusHash, options, cancellationToken);
 021        return Map(bookmarks);
 022    }
 23
 24    private IEnumerable<BookmarkBoundWorkflow> Map(IEnumerable<StoredBookmark> bookmarks)
 25    {
 026        var groupedBookmarks = bookmarks.GroupBy(x => x.WorkflowInstanceId);
 027        var bookmarkBoundWorkflows = new List<BookmarkBoundWorkflow>();
 28
 029        foreach (var bookmarkGroup in groupedBookmarks)
 30        {
 031            var workflowInstanceId = bookmarkGroup.Key;
 032            var bookmarkBoundWorkflow = new BookmarkBoundWorkflow(workflowInstanceId, bookmarkGroup.ToList());
 033            bookmarkBoundWorkflows.Add(bookmarkBoundWorkflow);
 34        }
 35
 036        return bookmarkBoundWorkflows;
 37    }
 38}