< 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
81%
Covered lines: 9
Uncovered lines: 2
Coverable lines: 11
Total lines: 66
Line coverage: 81.8%
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%

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;
 5
 6// ReSharper disable once CheckNamespace
 7namespace Elsa.Extensions;
 8
 9/// <summary>
 10/// Adds extensions to setup the <see cref="WorkflowRuntimeFeature"/> feature.
 11/// </summary>
 12public static class ModuleExtensions
 13{
 14    /// <summary>
 15    /// Enables the <see cref="WorkflowRuntimeFeature"/> feature.
 16    /// </summary>
 17    public static IModule UseWorkflowRuntime(this IModule module, Action<WorkflowRuntimeFeature>? configure = default)
 18    {
 719        module.Configure(configure);
 720        return module;
 21    }
 22
 23    /// <summary>
 24    /// Register the specified workflow type.
 25    /// </summary>
 26    public static IModule AddWorkflow<T>(this IModule module) where T : IWorkflow
 27    {
 928        module.Configure<WorkflowRuntimeFeature>().AddWorkflow<T>();
 929        return module;
 30    }
 31
 32    /// <summary>
 33    /// Register all workflows contained in the assembly containing the specified marker type.
 34    /// </summary>
 235    public static IModule AddWorkflowsFrom<TMarker>(this IModule module) => module.AddWorkflowsFrom(typeof(TMarker).Asse
 36
 37    /// <summary>
 38    /// Register all workflows in the specified assembly.
 39    /// </summary>
 40    public static IModule AddWorkflowsFrom(this IModule module, Assembly assembly)
 41    {
 242        module.Configure<WorkflowRuntimeFeature>().AddWorkflowsFrom(assembly);
 243        return module;
 44    }
 45
 46    /// <summary>
 47    /// Configures the default workflow runtime.
 48    /// </summary>
 49    /// <param name="feature">The workflow runtime feature.</param>
 50    /// <param name="configure">A callback that configures the default workflow runtime.</param>
 51    /// <returns>The workflow runtime feature.</returns>
 52    public static WorkflowRuntimeFeature UseDefaultRuntime(this WorkflowRuntimeFeature feature, Action<DefaultWorkflowRu
 53    {
 054        feature.Module.Configure(configure);
 055        return feature;
 56    }
 57
 58    /// <summary>
 59    /// Adds caching stores feature to the workflow runtime feature.
 60    /// </summary>
 61    public static WorkflowRuntimeFeature UseCache(this WorkflowRuntimeFeature feature, Action<CachingWorkflowRuntimeFeat
 62    {
 263        feature.Module.Configure(configure);
 264        return feature;
 65    }
 66}