< Summary

Information
Class: Elsa.Expressions.Liquid.Features.LiquidFeature
Assembly: Elsa.Expressions.Liquid
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.Liquid/Features/LiquidFeature.cs
Line coverage
75%
Covered lines: 15
Uncovered lines: 5
Coverable lines: 20
Total lines: 58
Line coverage: 75%
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
.ctor(...)100%1144.44%
get_FluidOptions()100%11100%
Apply()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.Liquid/Features/LiquidFeature.cs

#LineLine coverage
 1using Elsa.Caching.Features;
 2using Elsa.Common.Features;
 3using Elsa.Expressions.Features;
 4using Elsa.Extensions;
 5using Elsa.Features.Abstractions;
 6using Elsa.Features.Attributes;
 7using Elsa.Features.Services;
 8using Elsa.Expressions.Liquid.Contracts;
 9using Elsa.Expressions.Liquid.Filters;
 10using Elsa.Expressions.Liquid.Handlers;
 11using Elsa.Expressions.Liquid.Options;
 12using Elsa.Expressions.Liquid.Providers;
 13using Elsa.Expressions.Liquid.Services;
 14using Fluid.Filters;
 15using Microsoft.Extensions.DependencyInjection;
 16
 17namespace Elsa.Expressions.Liquid.Features;
 18
 19/// <summary>
 20/// Configures liquid functionality.
 21/// </summary>
 22[DependsOn(typeof(MemoryCacheFeature))]
 23[DependsOn(typeof(MediatorFeature))]
 24[DependsOn(typeof(ExpressionsFeature))]
 25public class LiquidFeature : FeatureBase
 26{
 27    /// <inheritdoc />
 128    public LiquidFeature(IModule serviceConfiguration) : base(serviceConfiguration)
 29    {
 130    }
 31
 32    /// <summary>
 33    /// Configures the Fluid options.
 34    /// </summary>
 335    public Action<FluidOptions> FluidOptions { get; set; } = options =>
 136    {
 037        options.ConfigureFilters = context => context.Options.Filters
 038            .WithArrayFilters()
 039            .WithStringFilters()
 040            .WithNumberFilters()
 041            .WithMiscFilters();
 142    };
 43
 44    /// <inheritdoc />
 45    public override void Apply()
 46    {
 147        Services.Configure(FluidOptions);
 48
 149        Services
 150            .AddHandlersFrom<ConfigureLiquidEngine>()
 151            .AddScoped<ILiquidTemplateManager, LiquidTemplateManager>()
 152            .AddScoped<LiquidParser>()
 153            .AddExpressionDescriptorProvider<LiquidExpressionDescriptorProvider>()
 154            .AddLiquidFilter<Base64Filter>("base64")
 155            .AddLiquidFilter<DictionaryKeysFilter>("keys")
 156        ;
 157    }
 58}