< Summary

Information
Class: Elsa.Extensions.ModuleExtensions
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Extensions/ModuleExtensions.cs
Line coverage
84%
Covered lines: 11
Uncovered lines: 2
Coverable lines: 13
Total lines: 76
Line coverage: 84.6%
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
UseWorkflowRuntime(...)100%11100%
AddWorkflow(...)100%11100%
AddWorkflowsFrom(...)100%11100%
AddWorkflowsFrom(...)100%11100%
UseDefaultRuntime(...)100%210%
UseCache(...)100%11100%
ConfigureGracefulShutdown(...)100%11100%

File(s)

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

#LineLine coverage
 1using System.Reflection;
 2using Elsa.Features.Services;
 3using Elsa.Workflows;
 4using Elsa.Workflows.Runtime.Features;
 5using Elsa.Workflows.Runtime.Options;
 6
 7// ReSharper disable once CheckNamespace
 8namespace Elsa.Extensions;
 9
 10/// <summary>
 11/// Adds extensions to setup the <see cref="WorkflowRuntimeFeature"/> feature.
 12/// </summary>
 13public static class ModuleExtensions
 14{
 15    /// <summary>
 16    /// Enables the <see cref="WorkflowRuntimeFeature"/> feature.
 17    /// </summary>
 18    public static IModule UseWorkflowRuntime(this IModule module, Action<WorkflowRuntimeFeature>? configure = default)
 19    {
 3220        module.Configure(configure);
 3221        return module;
 22    }
 23
 24    /// <summary>
 25    /// Register the specified workflow type.
 26    /// </summary>
 27    public static IModule AddWorkflow<T>(this IModule module) where T : IWorkflow
 28    {
 2029        module.Configure<WorkflowRuntimeFeature>().AddWorkflow<T>();
 2030        return module;
 31    }
 32
 33    /// <summary>
 34    /// Register all workflows contained in the assembly containing the specified marker type.
 35    /// </summary>
 636    public static IModule AddWorkflowsFrom<TMarker>(this IModule module) => module.AddWorkflowsFrom(typeof(TMarker).Asse
 37
 38    /// <summary>
 39    /// Register all workflows in the specified assembly.
 40    /// </summary>
 41    public static IModule AddWorkflowsFrom(this IModule module, Assembly assembly)
 42    {
 643        module.Configure<WorkflowRuntimeFeature>().AddWorkflowsFrom(assembly);
 644        return module;
 45    }
 46
 47    /// <summary>
 48    /// Configures the default workflow runtime.
 49    /// </summary>
 50    /// <param name="feature">The workflow runtime feature.</param>
 51    /// <param name="configure">A callback that configures the default workflow runtime.</param>
 52    /// <returns>The workflow runtime feature.</returns>
 53    public static WorkflowRuntimeFeature UseDefaultRuntime(this WorkflowRuntimeFeature feature, Action<DefaultWorkflowRu
 54    {
 055        feature.Module.Configure(configure);
 056        return feature;
 57    }
 58
 59    /// <summary>
 60    /// Adds caching stores feature to the workflow runtime feature.
 61    /// </summary>
 62    public static WorkflowRuntimeFeature UseCache(this WorkflowRuntimeFeature feature, Action<CachingWorkflowRuntimeFeat
 63    {
 664        feature.Module.Configure(configure);
 665        return feature;
 66    }
 67
 68    /// <summary>
 69    /// Configures the graceful-shutdown machinery of the workflow runtime.
 70    /// </summary>
 71    public static WorkflowRuntimeFeature ConfigureGracefulShutdown(this WorkflowRuntimeFeature feature, Action<GracefulS
 72    {
 573        feature.GracefulShutdown = configure;
 574        return feature;
 75    }
 76}