< Summary

Information
Class: Elsa.Http.Abstractions.DownloadableContentHandlerBase
Assembly: Elsa.Http
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/Abstractions/DownloadableContentHandlerBase.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 5
Coverable lines: 5
Total lines: 45
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Priority()100%210%
GetDownloadablesAsync(...)100%210%
GetDownloadableAsync(...)100%210%
GetDownloadable(...)100%210%
Elsa.Http.IDownloadableContentHandler.GetDownloadablesAsync(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/Abstractions/DownloadableContentHandlerBase.cs

#LineLine coverage
 1using Elsa.Http.Contexts;
 2
 3namespace Elsa.Http.Abstractions;
 4
 5/// <summary>
 6/// Provides a base class for <see cref="IDownloadableContentHandler"/> implementations.
 7/// </summary>
 8public abstract class DownloadableContentHandlerBase : IDownloadableContentHandler
 9{
 10    /// <inheritdoc />
 011    public virtual float Priority => 0;
 12
 13    /// <inheritdoc />
 14    public abstract bool GetSupportsContent(object content);
 15
 16    /// <summary>
 17    /// Returns a list of downloadables from the specified content.
 18    /// </summary>
 19    protected virtual IEnumerable<Func<ValueTask<Downloadable>>> GetDownloadablesAsync(DownloadableContext context)
 20    {
 021        return new[] { GetDownloadableAsync(context) };
 22    }
 23
 24    /// <summary>
 25    /// Returns a downloadable from the specified content.
 26    /// </summary>
 27    protected virtual Func<ValueTask<Downloadable>> GetDownloadableAsync(DownloadableContext context)
 28    {
 029        return () => ValueTask.FromResult(GetDownloadable(context));
 30    }
 31
 32    /// <summary>
 33    /// Returns a downloadable from the specified content.
 34    /// </summary>
 35    /// <exception cref="NotImplementedException">This method is not implemented. The derived class must implement at le
 36    protected virtual Downloadable GetDownloadable(DownloadableContext context)
 37    {
 038        throw new NotImplementedException();
 39    }
 40
 41    IEnumerable<Func<ValueTask<Downloadable>>> IDownloadableContentHandler.GetDownloadablesAsync(DownloadableContext con
 42    {
 043        return GetDownloadablesAsync(context);
 44    }
 45}