< Summary

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

File(s)

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

#LineLine coverage
 1using Elsa.Common.Features;
 2using Elsa.Extensions;
 3using Elsa.Features.Abstractions;
 4using Elsa.Features.Attributes;
 5using Elsa.Features.Services;
 6using Elsa.Labels.Contracts;
 7using Elsa.Labels.Entities;
 8using Elsa.Labels.Services;
 9using Microsoft.Extensions.DependencyInjection;
 10
 11namespace Elsa.Labels.Features;
 12
 13/// <summary>
 14/// Enables functionality to tag workflows with labels.
 15/// </summary>
 16[DependsOn(typeof(MediatorFeature))]
 17public class LabelsFeature : FeatureBase
 18{
 19    /// <inheritdoc />
 020    public LabelsFeature(IModule module) : base(module)
 21    {
 022    }
 23
 24    /// <summary>
 25    /// A delegate that provides an instance of an implementation of <see cref="ILabelStore"/>.
 26    /// </summary>
 027    public Func<IServiceProvider, ILabelStore> LabelStore { get; set; } = sp => sp.GetRequiredService<InMemoryLabelStore
 28
 29    /// <summary>
 30    /// A delegate that provides an instance of an implementation of <see cref="IWorkflowDefinitionLabelStore"/>.
 31    /// </summary>
 032    public Func<IServiceProvider, IWorkflowDefinitionLabelStore> WorkflowDefinitionLabelStore { get; set; } = sp => sp.G
 33
 34    /// <inheritdoc />
 35    public override void Configure()
 36    {
 037        Module.AddFastEndpointsAssembly(GetType());
 038    }
 39
 40    /// <inheritdoc />
 41    public override void Apply()
 42    {
 043        Services
 044            .AddMemoryStore<Label, InMemoryLabelStore>()
 045            .AddMemoryStore<WorkflowDefinitionLabel, InMemoryWorkflowDefinitionLabelStore>()
 046            .AddScoped(LabelStore)
 047            .AddScoped(WorkflowDefinitionLabelStore)
 048            ;
 49
 050        Services.AddNotificationHandlersFrom(GetType());
 051    }
 52}