< Summary

Information
Class: Elsa.Http.Services.DefaultDownloadableManager
Assembly: Elsa.Http
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/Services/DefaultDownloadableManager.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 10
Coverable lines: 10
Total lines: 33
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
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%210%
GetDownloadablesAsync(...)0%2040%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/Services/DefaultDownloadableManager.cs

#LineLine coverage
 1using Elsa.Http.Contexts;
 2using Elsa.Http.Options;
 3
 4namespace Elsa.Http.Services;
 5
 6/// <inheritdoc />
 7public class DefaultDownloadableManager : IDownloadableManager
 8{
 9    private readonly IEnumerable<IDownloadableContentHandler> _providers;
 10
 11    /// <summary>
 12    /// Initializes a new instance of the <see cref="DefaultDownloadableManager"/> class.
 13    /// </summary>
 014    public DefaultDownloadableManager(IEnumerable<IDownloadableContentHandler> providers)
 15    {
 016        _providers = providers.OrderBy(x => x.Priority).ToList();
 017    }
 18
 19    /// <inheritdoc />
 20    public IEnumerable<Func<ValueTask<Downloadable>>> GetDownloadablesAsync(object content, DownloadableOptions? options
 21    {
 022        var provider = _providers.FirstOrDefault(x => x.GetSupportsContent(content));
 23
 024        if (provider == null)
 025            return [];
 26
 027        options ??= new();
 028        var context = new DownloadableContext(this, content, options, cancellationToken);
 029        var downloadables = provider.GetDownloadablesAsync(context);
 30
 031        return downloadables;
 32    }
 33}