< Summary

Information
Class: Elsa.Workflows.Runtime.UIHints.DispatcherChannelOptionsProvider
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/UIHints/DispatcherChannelOptionsProvider.cs
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 31
Line coverage: 100%
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
.ctor(...)100%11100%
GetItemsAsync(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/UIHints/DispatcherChannelOptionsProvider.cs

#LineLine coverage
 1using System.Reflection;
 2using Elsa.Workflows.Runtime.Options;
 3using Elsa.Workflows.UIHints.Dropdown;
 4using Microsoft.Extensions.Options;
 5
 6namespace Elsa.Workflows.Runtime.UIHints;
 7
 8/// <summary>
 9/// Provides options for activities that dispatch workflows to channels.
 10/// </summary>
 11public class DispatcherChannelOptionsProvider : DropDownOptionsProviderBase
 12{
 13    private readonly WorkflowDispatcherOptions _options;
 14
 15    /// <inheritdoc />
 1746116    public DispatcherChannelOptionsProvider(IOptions<WorkflowDispatcherOptions> options)
 17    {
 1746118        _options = options.Value;
 1746119    }
 20
 21    /// <inheritdoc />
 22    protected override ValueTask<ICollection<SelectListItem>> GetItemsAsync(PropertyInfo propertyInfo, object? context, 
 23    {
 55624        var channelNames = _options.Channels.Select(x => x.Name).ToList();
 55625        var selectListItems = new List<SelectListItem> { new("Default", "") };
 26
 55627        selectListItems.AddRange(channelNames.Select(x => new SelectListItem(x, x)));
 28
 55629        return new(selectListItems);
 30    }
 31}