< Summary

Information
Class: Elsa.Mediator.Middleware.Request.RequestPipeline
Assembly: Elsa.Mediator
File(s): /home/runner/work/elsa-core/elsa-core/src/common/Elsa.Mediator/Middleware/Request/RequestPipeline.cs
Line coverage
12%
Covered lines: 1
Uncovered lines: 7
Coverable lines: 8
Total lines: 32
Line coverage: 12.5%
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%11100%
get_Pipeline()0%620%
Setup(...)0%620%
ExecuteAsync()100%210%
CreateDefaultPipeline()100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/common/Elsa.Mediator/Middleware/Request/RequestPipeline.cs

#LineLine coverage
 1using Elsa.Mediator.Middleware.Request.Contracts;
 2
 3namespace Elsa.Mediator.Middleware.Request;
 4
 5/// <inheritdoc />
 6public class RequestPipeline : IRequestPipeline
 7{
 8    private readonly IServiceProvider _serviceProvider;
 9    private RequestMiddlewareDelegate? _pipeline;
 10
 11    /// <summary>
 12    /// Initializes a new instance of the <see cref="RequestPipeline"/> class.
 13    /// </summary>
 214    public RequestPipeline(IServiceProvider serviceProvider) => _serviceProvider = serviceProvider;
 15
 16    /// <inheritdoc />
 017    public RequestMiddlewareDelegate Pipeline => _pipeline ??= CreateDefaultPipeline();
 18
 19    /// <inheritdoc />
 20    public RequestMiddlewareDelegate Setup(Action<IRequestPipelineBuilder>? setup = default)
 21    {
 022        var builder = new RequestPipelineBuilder(_serviceProvider);
 023        setup?.Invoke(builder);
 024        _pipeline = builder.Build();
 025        return _pipeline;
 26    }
 27
 28    /// <inheritdoc />
 029    public async Task ExecuteAsync(RequestContext context) => await Pipeline(context);
 30
 031    private RequestMiddlewareDelegate CreateDefaultPipeline() => Setup(x => x.UseRequestHandlers());
 32}