< Summary

Information
Class: Elsa.Resilience.StrategySources.ConfigurationResilienceStrategySource
Assembly: Elsa.Resilience
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Resilience/StrategySources/ConfigurationResilienceStrategySource.cs
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 19
Line coverage: 100%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
GetStrategiesAsync(...)100%11100%
GetStrategies()50%22100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Resilience/StrategySources/ConfigurationResilienceStrategySource.cs

#LineLine coverage
 1using Elsa.Extensions;
 2using Elsa.Resilience.Serialization;
 3using Microsoft.Extensions.Configuration;
 4
 5namespace Elsa.Resilience.StrategySources;
 6
 27public class ConfigurationResilienceStrategySource(IConfiguration configuration, ResilienceStrategySerializer serializer
 8{
 9    public Task<IEnumerable<IResilienceStrategy>> GetStrategiesAsync(CancellationToken cancellationToken = default)
 10    {
 111        return Task.FromResult(GetStrategies());
 12    }
 13
 14    private IEnumerable<IResilienceStrategy> GetStrategies()
 15    {
 116        var json = configuration.GetSectionAsJson("Resilience:Strategies");
 117        return string.IsNullOrWhiteSpace(json) ? [] : serializer.DeserializeMany(json);
 18    }
 19}