< 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: 10
Coverable lines: 10
Total lines: 47
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.Common.ShellFeatures;
 3using Elsa.Extensions;
 4using Elsa.Labels.Contracts;
 5using Elsa.Labels.Entities;
 6using Elsa.Labels.Services;
 7using Elsa.Platform.PackageManifest.Generator.Hints;
 8using Elsa.Workflows.Management;
 9using JetBrains.Annotations;
 10using Microsoft.Extensions.DependencyInjection;
 11
 12namespace Elsa.Labels.ShellFeatures;
 13
 14/// <summary>
 15/// Enables functionality to tag workflows with labels.
 16/// </summary>
 17[ManifestFeatureCategory("Labels")]
 18[ShellFeature(
 19    DisplayName = "Labels",
 20    Description = "Enables functionality to tag workflows with labels",
 21    DependsOn = [typeof(MediatorFeature)])]
 22[UsedImplicitly]
 23public class LabelsFeature : IShellFeature
 24{
 25    /// <summary>
 26    /// A delegate that provides an instance of an implementation of <see cref="ILabelStore"/>.
 27    /// </summary>
 028    public Func<IServiceProvider, ILabelStore> LabelStore { get; set; } = sp => sp.GetRequiredService<InMemoryLabelStore
 29
 30    /// <summary>
 31    /// A delegate that provides an instance of an implementation of <see cref="IWorkflowDefinitionLabelStore"/>.
 32    /// </summary>
 033    public Func<IServiceProvider, IWorkflowDefinitionLabelStore> WorkflowDefinitionLabelStore { get; set; } = sp => sp.G
 34
 35    public void ConfigureServices(IServiceCollection services)
 36    {
 037        services
 038            .AddMemoryStore<Label, InMemoryLabelStore>()
 039            .AddMemoryStore<WorkflowDefinitionLabel, InMemoryWorkflowDefinitionLabelStore>()
 040            .AddScoped(LabelStore)
 041            .AddScoped(WorkflowDefinitionLabelStore)
 042            .AddScoped<IWorkflowDefinitionFilterProvider, WorkflowDefinitionLabelFilterProvider>();
 43
 044        services.AddNotificationHandlersFrom(GetType());
 045    }
 46}
 47