< Summary

Information
Class: Elsa.Common.Services.CompressionCodecResolver
Assembly: Elsa.Common
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Common/Services/CompressionCodecResolver.cs
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 23
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%
Resolve(...)50%22100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Common/Services/CompressionCodecResolver.cs

#LineLine coverage
 1using Elsa.Common.Codecs;
 2
 3namespace Elsa.Common.Services;
 4
 5/// <inheritdoc />
 6public class CompressionCodecResolver : ICompressionCodecResolver
 7{
 8    private readonly IDictionary<string, ICompressionCodec> _codecs;
 9
 10    /// <summary>
 11    /// Initializes a new instance of the <see cref="CompressionCodecResolver"/> class.
 12    /// </summary>
 113    public CompressionCodecResolver(IEnumerable<ICompressionCodec> codecs)
 14    {
 415        _codecs = codecs.ToDictionary(c => c.GetType().Name);
 116    }
 17
 18    /// <inheritdoc />
 19    public ICompressionCodec Resolve(string name)
 20    {
 107421        return _codecs.TryGetValue(name, out var codec) ? codec : new None();
 22    }
 23}