< 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
50%
Covered lines: 10
Uncovered lines: 10
Coverable lines: 20
Total lines: 88
Line coverage: 50%
Branch coverage
50%
Covered branches: 5
Total branches: 10
Branch coverage: 50%
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%
AddActivityHost(...)100%22100%
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    {
 8419        module.Configure<WorkflowManagementFeature>(management =>
 8420        {
 8421            management.AddActivity<NotFoundActivity>();
 8422            configure?.Invoke(management);
 16823        });
 8424        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>
 7048    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    /// Registers the specified activity host type to the workflow system.
 57    /// </summary>
 2858    public static IModule AddActivityHost<T>(this IModule module) where T : class => module.UseWorkflowManagement(manage
 59
 60    /// <summary>
 61    /// Removes the specified activity type from the system.
 62    /// </summary>
 063    public static IModule RemoveActivity<T>(this IModule module) where T : IActivity => module.UseWorkflowManagement(man
 64
 65    /// <summary>
 66    /// Adds the specified variable type to the system.
 67    /// </summary>
 068    public static IModule AddVariableType<T>(this IModule module, string category) => module.UseWorkflowManagement(manag
 69
 70    /// <summary>
 71    /// Adds a variable type and its alias to the specified module.
 72    /// </summary>
 73    public static IModule AddVariableTypeAndAlias<T>(this IModule module, string alias, string category)
 74    {
 075        return module
 076            .UseWorkflowManagement(management => management.AddVariableType<T>(category))
 077            .AddTypeAlias<T>(alias);
 78    }
 79
 80    /// <summary>
 81    /// Adds caching stores feature to the workflow management feature.
 82    /// </summary>
 83    public static WorkflowManagementFeature UseCache(this WorkflowManagementFeature feature, Action<CachingWorkflowDefin
 84    {
 1485        feature.Module.Configure(configure);
 1486        return feature;
 87    }
 88}