< Summary

Information
Class: Elsa.Workflows.UIHints.CheckList.StaticCheckListOptionsProvider
Assembly: Elsa.Workflows.Core
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/UIHints/CheckList/StaticCheckListOptionsProvider.cs
Line coverage
77%
Covered lines: 7
Uncovered lines: 2
Coverable lines: 9
Total lines: 29
Line coverage: 77.7%
Branch coverage
50%
Covered branches: 4
Total branches: 8
Branch coverage: 50%
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(...)50%9875%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Core/UIHints/CheckList/StaticCheckListOptionsProvider.cs

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