< Summary

Information
Class: Elsa.Workflows.Runtime.TaskReporter
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Services/TaskReporter.cs
Line coverage
5%
Covered lines: 1
Uncovered lines: 17
Coverable lines: 18
Total lines: 35
Line coverage: 5.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
.ctor(...)100%11100%
.cctor()100%210%
ReportCompletionAsync()100%210%

File(s)

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

#LineLine coverage
 1using Elsa.Workflows.Helpers;
 2using Elsa.Workflows.Runtime.Activities;
 3using Elsa.Workflows.Runtime.Options;
 4using Elsa.Workflows.Runtime.Stimuli;
 5
 6namespace Elsa.Workflows.Runtime;
 7
 8/// <inheritdoc />
 19public class TaskReporter(IBookmarkQueue bookmarkQueue, IStimulusHasher stimulusHasher) : ITaskReporter
 10{
 011    private static readonly string ActivityTypeName = ActivityTypeNameHelper.GenerateTypeName<RunTask>();
 12
 13    /// <inheritdoc />
 14    public async Task ReportCompletionAsync(string taskId, object? result = null, CancellationToken cancellationToken = 
 15    {
 016        var stimulus = new RunTaskStimulus(taskId, null!);
 17
 018        var input = new Dictionary<string, object>
 019        {
 020            [RunTask.InputKey] = result!
 021        };
 22
 023        var bookmarkQueueItem = new NewBookmarkQueueItem
 024        {
 025            ActivityTypeName = ActivityTypeName,
 026            StimulusHash = stimulusHasher.Hash(ActivityTypeName, stimulus),
 027            Options = new()
 028            {
 029                Input = input
 030            }
 031        };
 32
 033        await bookmarkQueue.EnqueueAsync(bookmarkQueueItem, cancellationToken);
 034    }
 35}