< Summary

Information
Class: Elsa.Extensions.ModuleExtensions
Assembly: Elsa.Workflows.Management
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Extensions/ModuleExtensions.cs
Line coverage
47%
Covered lines: 9
Uncovered lines: 10
Coverable lines: 19
Total lines: 83
Line coverage: 47.3%
Branch coverage
37%
Covered branches: 3
Total branches: 8
Branch coverage: 37.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
UseWorkflowManagement(...)50%22100%
UseWorkflowDefinitions(...)100%210%
UseWorkflowInstances(...)100%210%
AddActivitiesFrom(...)100%22100%
AddActivity(...)0%620%
RemoveActivity(...)0%620%
AddVariableType(...)100%210%
AddVariableTypeAndAlias(...)100%210%
UseCache(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Extensions/ModuleExtensions.cs

#LineLine coverage
 1using Elsa.Features.Services;
 2using Elsa.Workflows;
 3using Elsa.Workflows.Activities;
 4using Elsa.Workflows.Management.Features;
 5
 6// ReSharper disable once CheckNamespace
 7namespace Elsa.Extensions;
 8
 9/// <summary>
 10/// Provides extensions to the specified <see cref="IModule"/>/
 11/// </summary>
 12public static class ModuleExtensions
 13{
 14    /// <summary>
 15    /// Adds the workflow management feature to the specified module.
 16    /// </summary>
 17    public static IModule UseWorkflowManagement(this IModule module, Action<WorkflowManagementFeature>? configure = null
 18    {
 1019        module.Configure<WorkflowManagementFeature>(management =>
 1020        {
 1021            management.AddActivity<NotFoundActivity>();
 1022            configure?.Invoke(management);
 2023        });
 1024        return module;
 25    }
 26
 27    /// <summary>
 28    /// Adds the default workflow management feature to the specified module.
 29    /// </summary>
 30    public static WorkflowManagementFeature UseWorkflowDefinitions(this WorkflowManagementFeature feature, Action<Workfl
 31    {
 032        feature.Module.Configure(configure);
 033        return feature;
 34    }
 35
 36    /// <summary>
 37    /// Adds the workflow instance feature to workflow management module.
 38    /// </summary>
 39    public static WorkflowManagementFeature UseWorkflowInstances(this WorkflowManagementFeature feature, Action<Workflow
 40    {
 041        feature.Module.Configure(configure);
 042        return feature;
 43    }
 44
 45    /// <summary>
 46    /// Adds all types implementing <see cref="IActivity"/> to the system.
 47    /// </summary>
 1048    public static IModule AddActivitiesFrom<TMarkerType>(this IModule module) => module.UseWorkflowManagement(management
 49
 50    /// <summary>
 51    /// Adds the specified activity type to the system.
 52    /// </summary>
 053    public static IModule AddActivity<T>(this IModule module) where T : IActivity => module.UseWorkflowManagement(manage
 54
 55    /// <summary>
 56    /// Removes the specified activity type from the system.
 57    /// </summary>
 058    public static IModule RemoveActivity<T>(this IModule module) where T : IActivity => module.UseWorkflowManagement(man
 59
 60    /// <summary>
 61    /// Adds the specified variable type to the system.
 62    /// </summary>
 063    public static IModule AddVariableType<T>(this IModule module, string category) => module.UseWorkflowManagement(manag
 64
 65    /// <summary>
 66    /// Adds a variable type and its alias to the specified module.
 67    /// </summary>
 68    public static IModule AddVariableTypeAndAlias<T>(this IModule module, string alias, string category)
 69    {
 070        return module
 071            .UseWorkflowManagement(management => management.AddVariableType<T>(category))
 072            .AddTypeAlias<T>(alias);
 73    }
 74
 75    /// <summary>
 76    /// Adds caching stores feature to the workflow management feature.
 77    /// </summary>
 78    public static WorkflowManagementFeature UseCache(this WorkflowManagementFeature feature, Action<CachingWorkflowDefin
 79    {
 280        feature.Module.Configure(configure);
 281        return feature;
 82    }
 83}