< Summary

Information
Class: Elsa.Resilience.Recorders.ActivityExecutionContextRetryAttemptReader
Assembly: Elsa.Resilience
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Resilience/Recorders/ActivityExecutionContextRetryAttemptReader.cs
Line coverage
10%
Covered lines: 1
Uncovered lines: 9
Coverable lines: 10
Total lines: 25
Line coverage: 10%
Branch coverage
0%
Covered branches: 0
Total branches: 8
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%
ReadAttemptsAsync()0%7280%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Resilience/Recorders/ActivityExecutionContextRetryAttemptReader.cs

#LineLine coverage
 1using Elsa.Common.Models;
 2using Elsa.Expressions.Helpers;
 3using Elsa.Extensions;
 4using Elsa.Resilience.Entities;
 5using Elsa.Workflows.Runtime;
 6
 7namespace Elsa.Resilience.Recorders;
 8
 19public class ActivityExecutionContextRetryAttemptReader(IActivityExecutionStore activityExecutionStore) : IRetryAttemptR
 10{
 11    public async Task<Page<RetryAttemptRecord>> ReadAttemptsAsync(string activityInstanceId, PageArgs? pageArgs = null, 
 12    {
 013        var record = await activityExecutionStore.FindAsync(new()
 014        {
 015            Id = activityInstanceId
 016        }, cancellationToken);
 17
 018        if (record?.Properties == null || !record.Properties.TryGetValue("RetryAttempts", out var value))
 019            return Page.Empty<RetryAttemptRecord>();
 20
 021        var retryAttempts = value.ConvertTo<ICollection<RetryAttemptRecord>>() ?? [];
 22
 023        return retryAttempts.Paginate(pageArgs);
 024    }
 25}