< Summary

Information
Class: Elsa.Workflows.UIHints.RadioList.StaticRadioListOptionsProvider
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/UIHints/RadioList/StaticRadioListOptionsProvider.cs
Line coverage
11%
Covered lines: 1
Uncovered lines: 8
Coverable lines: 9
Total lines: 29
Line coverage: 11.1%
Branch coverage
0%
Covered branches: 0
Total branches: 8
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Priority()100%11100%
GetItemsAsync(...)0%7280%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/UIHints/RadioList/StaticRadioListOptionsProvider.cs

#LineLine coverage
 1using System.Reflection;
 2using Elsa.Workflows.Attributes;
 3
 4namespace Elsa.Workflows.UIHints.RadioList;
 5
 6/// <summary>
 7/// Provides static drop-down options for a given property.
 8/// </summary>
 9public class StaticRadioListOptionsProvider : RadioListOptionsProviderBase
 10{
 1613611    public override float Priority => -1;
 12
 13    /// <inheritdoc />
 14    protected override ValueTask<ICollection<RadioListItem>> GetItemsAsync(PropertyInfo propertyInfo, object? context, C
 15    {
 016        var inputAttribute = propertyInfo.GetCustomAttribute<InputAttribute>();
 017        var inputOptions = inputAttribute?.Options;
 18
 019        if (inputOptions == null)
 020            return new([]);
 21
 022        var selectListItems = (inputOptions as ICollection<string>)?.Select(x => new RadioListItem(x, x)).ToList();
 23
 024        if (selectListItems == null)
 025            return new([]);
 26
 027        return new(selectListItems);
 28    }
 29}