< Summary

Information
Class: Elsa.Labels.ShellFeatures.LabelsFeature
Assembly: Elsa.Labels
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Labels/ShellFeatures/LabelsFeature.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 9
Coverable lines: 9
Total lines: 42
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
get_LabelStore()100%210%
get_WorkflowDefinitionLabelStore()100%210%
ConfigureServices(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Labels/ShellFeatures/LabelsFeature.cs

#LineLine coverage
 1using CShells.Features;
 2using Elsa.Extensions;
 3using Elsa.Labels.Contracts;
 4using Elsa.Labels.Entities;
 5using Elsa.Labels.Services;
 6using JetBrains.Annotations;
 7using Microsoft.Extensions.DependencyInjection;
 8
 9namespace Elsa.Labels.ShellFeatures;
 10
 11/// <summary>
 12/// Enables functionality to tag workflows with labels.
 13/// </summary>
 14[ShellFeature(
 15    DisplayName = "Labels",
 16    Description = "Enables functionality to tag workflows with labels",
 17    DependsOn = ["Mediator"])]
 18[UsedImplicitly]
 19public class LabelsFeature : IShellFeature
 20{
 21    /// <summary>
 22    /// A delegate that provides an instance of an implementation of <see cref="ILabelStore"/>.
 23    /// </summary>
 024    public Func<IServiceProvider, ILabelStore> LabelStore { get; set; } = sp => sp.GetRequiredService<InMemoryLabelStore
 25
 26    /// <summary>
 27    /// A delegate that provides an instance of an implementation of <see cref="IWorkflowDefinitionLabelStore"/>.
 28    /// </summary>
 029    public Func<IServiceProvider, IWorkflowDefinitionLabelStore> WorkflowDefinitionLabelStore { get; set; } = sp => sp.G
 30
 31    public void ConfigureServices(IServiceCollection services)
 32    {
 033        services
 034            .AddMemoryStore<Label, InMemoryLabelStore>()
 035            .AddMemoryStore<WorkflowDefinitionLabel, InMemoryWorkflowDefinitionLabelStore>()
 036            .AddScoped(LabelStore)
 037            .AddScoped(WorkflowDefinitionLabelStore);
 38
 039        services.AddNotificationHandlersFrom(GetType());
 040    }
 41}
 42