< Summary

Information
Class: Elsa.Extensions.ModuleExtensions
Assembly: Elsa.Expressions
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions/Extensions/ModuleExtensions.cs
Line coverage
60%
Covered lines: 3
Uncovered lines: 2
Coverable lines: 5
Total lines: 48
Line coverage: 60%
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
UseExpressions(...)100%210%
AddExpressionDescriptorProvider(...)100%11100%
AddTypeAlias(...)100%11100%

File(s)

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

#LineLine coverage
 1using Elsa.Expressions.Contracts;
 2using Elsa.Expressions.Features;
 3using Elsa.Expressions.Options;
 4using Elsa.Features.Services;
 5using JetBrains.Annotations;
 6using Microsoft.Extensions.DependencyInjection;
 7
 8// ReSharper disable once CheckNamespace
 9namespace Elsa.Extensions;
 10
 11/// <summary>
 12/// Extends <see cref="IModule"/>.
 13/// </summary>
 14[PublicAPI]
 15public static class ModuleExtensions
 16{
 17    /// <summary>
 18    /// Installs the expressions feature.
 19    /// </summary>
 20    /// <param name="module">The module.</param>
 21    /// <param name="configure">A delegate to configure the <see cref="ExpressionsFeature"/>.</param>
 22    public static IModule UseExpressions(this IModule module, Action<ExpressionsFeature>? configure = default)
 23    {
 024        module.Configure(configure);
 025        return module;
 26    }
 27
 28    /// <summary>
 29    /// Installs the expressions feature.
 30    /// </summary>
 31    /// <param name="services">The services.</param>
 32    public static IServiceCollection AddExpressionDescriptorProvider<T>(this IServiceCollection services) where T: class
 33    {
 434        return services.AddSingleton<IExpressionDescriptorProvider, T>();
 35    }
 36
 37    /// <summary>
 38    /// Register type <typeparamref name="T"/> with the specified alias.
 39    /// </summary>
 40    /// <param name="module">The module.</param>
 41    /// <param name="alias">The alias.</param>
 42    /// <typeparam name="T">The type.</typeparam>
 43    public static IModule AddTypeAlias<T>(this IModule module, string alias)
 44    {
 245        module.Services.Configure<ExpressionOptions>(options => options.AddTypeAlias<T>(alias));
 146        return module;
 47    }
 48}