< Summary

Information
Class: Elsa.Resilience.Extensions.ActivityExecutionExtensions
Assembly: Elsa.Resilience.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Resilience.Core/Extensions/ActivityExecutionExtensions.cs
Line coverage
12%
Covered lines: 1
Uncovered lines: 7
Coverable lines: 8
Total lines: 31
Line coverage: 12.5%
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
SetRetriesAttemptedFlag(...)0%620%
GetRetriesAttemptedFlag(...)100%11100%
SetResilienceStrategy(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Resilience.Core/Extensions/ActivityExecutionExtensions.cs

#LineLine coverage
 1using System.Text.Json.Nodes;
 2using Elsa.Workflows;
 3
 4namespace Elsa.Resilience.Extensions;
 5
 6public static class ActivityExecutionExtensions
 7{
 8    private const string RetriesAttemptedFlag = "HasRetryAttempts";
 9    private const string ResilienceStrategy = "ResilienceStrategy";
 10
 11    public static void SetRetriesAttemptedFlag(this ActivityExecutionContext context)
 12    {
 013        var current = context;
 14
 015        while (current != null)
 16        {
 017            current.SetMetadata(RetriesAttemptedFlag, true);
 018            current = current.ParentActivityExecutionContext;
 19        }
 020    }
 21
 22    public static bool GetRetriesAttemptedFlag(this ActivityExecutionContext context)
 23    {
 2624        return context.GetMetadata(RetriesAttemptedFlag, () => false);
 25    }
 26
 27    public static void SetResilienceStrategy(this ActivityExecutionContext context, JsonNode model)
 28    {
 029        context.SetProperty(ResilienceStrategy, model);
 030    }
 31}