< Summary

Information
Class: Elsa.Extensions.MediatorExtensions
Assembly: Elsa.Mediator
File(s): /home/runner/work/elsa-core/elsa-core/src/common/Elsa.Mediator/Extensions/MediatorExtensions.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 8
Coverable lines: 8
Total lines: 55
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
SendAsync()100%210%
SendAsync()100%210%
SendAsync()100%210%
SendAsync()100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/common/Elsa.Mediator/Extensions/MediatorExtensions.cs

#LineLine coverage
 1using Elsa.Mediator.Contracts;
 2using Elsa.Mediator.Options;
 3
 4// ReSharper disable once CheckNamespace
 5namespace Elsa.Extensions;
 6
 7/// <summary>
 8/// Provides a set of extension methods for <see cref="IMediator"/>.
 9/// </summary>
 10public static class MediatorExtensions
 11{
 12    /// <summary>
 13    /// Sends a notification using the default notification strategy configured via <see cref="MediatorOptions"/>.
 14    /// </summary>
 15    /// <param name="mediator">The mediator.</param>
 16    /// <param name="notification">The notification to send.</param>
 17    /// <param name="cancellationToken">The cancellation token.</param>
 18    public static async Task SendAsync(this IMediator mediator, INotification notification, CancellationToken cancellati
 19    {
 020        await mediator.SendAsync(notification, default, cancellationToken);
 021    }
 22
 23    /// <summary>
 24    /// Sends a notification using the default notification strategy configured via <see cref="MediatorOptions"/>.
 25    /// </summary>
 26    /// <param name="publisher">The publisher.</param>
 27    /// <param name="notification">The notification to send.</param>
 28    /// <param name="cancellationToken">The cancellation token.</param>
 29    public static async Task SendAsync(this INotificationSender publisher, INotification notification, CancellationToken
 30    {
 031        await publisher.SendAsync(notification, default, cancellationToken);
 032    }
 33
 34    /// <summary>
 35    /// Sends a command using the default command strategy configured via <see cref="MediatorOptions"/>.
 36    /// </summary>
 37    /// <param name="mediator">The mediator.</param>
 38    /// <param name="command">The command to send.</param>
 39    /// <param name="cancellationToken">The cancellation token.</param>
 40    public static async Task SendAsync(this IMediator mediator, ICommand command, CancellationToken cancellationToken = 
 41    {
 042        await mediator.SendAsync(command, null, cancellationToken);
 043    }
 44
 45    /// <summary>
 46    /// Sends a command using the default command strategy configured via <see cref="MediatorOptions"/>.
 47    /// </summary>
 48    /// <param name="commandSender">The command sender.</param>
 49    /// <param name="command">The command to send.</param>
 50    /// <param name="cancellationToken">The cancellation token.</param>
 51    public static async Task SendAsync(this ICommandSender commandSender, ICommand command, CancellationToken cancellati
 52    {
 053        await commandSender.SendAsync(command, null, cancellationToken);
 054    }
 55}