< Summary

Information
Class: Elsa.Workflows.Management.Services.ExpressionDescriptorRegistry
Assembly: Elsa.Workflows.Management
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Services/ExpressionDescriptorRegistry.cs
Line coverage
100%
Covered lines: 14
Uncovered lines: 0
Coverable lines: 14
Total lines: 44
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
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%22100%
Add(...)100%11100%
AddRange(...)100%22100%
ListAll()100%11100%
Find(...)100%11100%
Find(...)100%22100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Services/ExpressionDescriptorRegistry.cs

#LineLine coverage
 1using Elsa.Expressions.Contracts;
 2using Elsa.Expressions.Models;
 3
 4namespace Elsa.Workflows.Management.Services;
 5
 6/// <inheritdoc />
 7public class ExpressionDescriptorRegistry : IExpressionDescriptorRegistry
 8{
 3309    private readonly IDictionary<string, ExpressionDescriptor> _expressionSyntaxDescriptors = new Dictionary<string, Exp
 10
 11    /// <summary>
 12    /// Represents a registry of expression descriptors.
 13    /// </summary>
 33014    public ExpressionDescriptorRegistry(IEnumerable<IExpressionDescriptorProvider> providers)
 15    {
 133016        foreach (var provider in providers)
 17        {
 33518            var descriptors = provider.GetDescriptors();
 33519            AddRange(descriptors);
 20        }
 33021    }
 22
 23    /// <inheritdoc />
 24    public void Add(ExpressionDescriptor descriptor)
 25    {
 191926        _expressionSyntaxDescriptors[descriptor.Type] = descriptor;
 191927    }
 28
 29    /// <inheritdoc />
 30    public void AddRange(IEnumerable<ExpressionDescriptor> descriptors)
 31    {
 450832        foreach (var descriptor in descriptors)
 191833            Add(descriptor);
 33634    }
 35
 36    /// <inheritdoc />
 637    public IEnumerable<ExpressionDescriptor> ListAll() => _expressionSyntaxDescriptors.Values;
 38
 39    /// <inheritdoc />
 240    public ExpressionDescriptor? Find(Func<ExpressionDescriptor, bool> predicate) => _expressionSyntaxDescriptors.Values
 41
 42    /// <inheritdoc />
 732943    public ExpressionDescriptor? Find(string type) => _expressionSyntaxDescriptors.TryGetValue(type, out var descriptor)
 44}