< Summary

Information
Class: Elsa.Http.DownloadableContentHandlers.MultiDownloadableContentHandler
Assembly: Elsa.Http
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/DownloadableContentHandlers/MultiDownloadableContentHandler.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 9
Coverable lines: 9
Total lines: 31
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
GetSupportsContent(...)0%2040%
GetDownloadablesAsync(...)0%620%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/DownloadableContentHandlers/MultiDownloadableContentHandler.cs

#LineLine coverage
 1using System.Collections;
 2using Elsa.Http.Abstractions;
 3using Elsa.Http.Contexts;
 4
 5namespace Elsa.Http.DownloadableContentHandlers;
 6
 7/// <summary>
 8/// Handles content that represents a list of downloadable objects.
 9/// </summary>
 10public class MultiDownloadableContentHandler : DownloadableContentHandlerBase
 11{
 12    /// <inheritdoc />
 013    public override bool GetSupportsContent(object content) => content is IEnumerable and not string and not byte[];
 14
 15    /// <inheritdoc />
 16    protected override IEnumerable<Func<ValueTask<Downloadable>>> GetDownloadablesAsync(DownloadableContext context)
 17    {
 018        var collectedDownloadables = new List<Func<ValueTask<Downloadable>>>();
 019        var content = context.Content;
 020        var enumerable = (IEnumerable) content;
 021        var manager = context.Manager;
 22
 023        foreach (var item in enumerable)
 24        {
 025            var downloadables = manager.GetDownloadablesAsync(item, context.Options, context.CancellationToken);
 026            collectedDownloadables.AddRange(downloadables);
 27        }
 28
 029        return collectedDownloadables;
 30    }
 31}