< Summary

Information
Class: Elsa.Expressions.CSharp.Features.CSharpFeature
Assembly: Elsa.Expressions.CSharp
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.CSharp/Features/CSharpFeature.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 56
Line coverage: 100%
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%11100%
get_CSharpOptions()100%11100%
Apply()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Expressions.CSharp/Features/CSharpFeature.cs

#LineLine coverage
 1using Elsa.Caching.Features;
 2using Elsa.Common.Features;
 3using Elsa.Expressions.CSharp.Activities;
 4using Elsa.Expressions.CSharp.Contracts;
 5using Elsa.Expressions.CSharp.Options;
 6using Elsa.Expressions.CSharp.Providers;
 7using Elsa.Expressions.CSharp.Services;
 8using Elsa.Expressions.Features;
 9using Elsa.Extensions;
 10using Elsa.Features.Abstractions;
 11using Elsa.Features.Attributes;
 12using Elsa.Features.Services;
 13using Elsa.Workflows;
 14using Microsoft.Extensions.DependencyInjection;
 15
 16namespace Elsa.Expressions.CSharp.Features;
 17
 18/// <summary>
 19/// Installs C# integration.
 20/// </summary>
 21[DependsOn(typeof(MediatorFeature))]
 22[DependsOn(typeof(ExpressionsFeature))]
 23[DependsOn(typeof(MemoryCacheFeature))]
 24public class CSharpFeature : FeatureBase
 25{
 26    /// <inheritdoc />
 127    public CSharpFeature(IModule module) : base(module)
 28    {
 129    }
 30
 31    /// <summary>
 32    /// Configures the <see cref="CSharpOptions"/>.
 33    /// </summary>
 534    public Action<CSharpOptions> CSharpOptions { get; set; } = _ => { };
 35
 36    /// <inheritdoc />
 37    public override void Apply()
 38    {
 139        Services.Configure(CSharpOptions);
 40
 41        // C# services.
 142        Services
 143            .AddExpressionDescriptorProvider<CSharpExpressionDescriptorProvider>()
 144            .AddScoped<ICSharpEvaluator, CSharpEvaluator>()
 145            ;
 46
 47        // Handlers.
 148        Services.AddNotificationHandlersFrom<CSharpFeature>();
 49
 50        // Activities.
 151        Module.AddActivitiesFrom<CSharpFeature>();
 52
 53        // UI property handlers.
 154        Services.AddScoped<IPropertyUIHandler, RunCSharpOptionsProvider>();
 155    }
 56}