< Summary

Information
Class: Elsa.Mediator.Middleware.Notification.NotificationPipeline
Assembly: Elsa.Mediator
File(s): /home/runner/work/elsa-core/elsa-core/src/common/Elsa.Mediator/Middleware/Notification/NotificationPipeline.cs
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 32
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
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()100%22100%
Setup(...)100%22100%
ExecuteAsync()100%11100%
CreateDefaultPipeline()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/common/Elsa.Mediator/Middleware/Notification/NotificationPipeline.cs

#LineLine coverage
 1using Elsa.Mediator.Middleware.Notification.Contracts;
 2
 3namespace Elsa.Mediator.Middleware.Notification;
 4
 5/// <inheritdoc />
 6public class NotificationPipeline : INotificationPipeline
 7{
 8    private readonly IServiceProvider _serviceProvider;
 9    private NotificationMiddlewareDelegate? _pipeline;
 10
 11    /// <summary>
 12    /// Initializes a new instance of the <see cref="NotificationPipeline"/> class.
 13    /// </summary>
 214    public NotificationPipeline(IServiceProvider serviceProvider) => _serviceProvider = serviceProvider;
 15
 16    /// <inheritdoc />
 1131617    public NotificationMiddlewareDelegate Pipeline => _pipeline ??= CreateDefaultPipeline();
 18
 19    /// <inheritdoc />
 20    public NotificationMiddlewareDelegate Setup(Action<INotificationPipelineBuilder>? setup = default)
 21    {
 122        var builder = new NotificationPipelineBuilder(_serviceProvider);
 123        setup?.Invoke(builder);
 124        _pipeline = builder.Build();
 125        return _pipeline;
 26    }
 27
 28    /// <inheritdoc />
 1131629    public async Task ExecuteAsync(NotificationContext context) => await Pipeline(context);
 30
 231    private NotificationMiddlewareDelegate CreateDefaultPipeline() => Setup(x => x.UseNotificationHandlers());
 32}