< Summary

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

File(s)

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

#LineLine coverage
 1using CShells.Features;
 2using Elsa.Expressions.CSharp.ActivityDescriptorModifiers;
 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.Extensions;
 9using Elsa.Workflows;
 10using JetBrains.Annotations;
 11using Microsoft.Extensions.DependencyInjection;
 12
 13namespace Elsa.Expressions.CSharp.ShellFeatures;
 14
 15/// <summary>
 16/// Installs C# integration.
 17/// </summary>
 18[ShellFeature(
 19    DisplayName = "C# Expressions",
 20    Description = "Provides C# expression evaluation capabilities for workflows",
 21    DependsOn = ["Mediator", "Expressions", "MemoryCache"])]
 22[UsedImplicitly]
 23public class CSharpFeature : IShellFeature
 24{
 25    /// <summary>
 26    /// Configures the <see cref="CSharpOptions"/>.
 27    /// </summary>
 028    public Action<CSharpOptions> CSharpOptions { get; set; } = _ => { };
 29
 30    public void ConfigureServices(IServiceCollection services)
 31    {
 032        services.Configure(CSharpOptions);
 33
 34        // C# services.
 035        services
 036            .AddExpressionDescriptorProvider<CSharpExpressionDescriptorProvider>()
 037            .AddScoped<ICSharpEvaluator, CSharpEvaluator>()
 038            .AddSingleton<IActivityDescriptorModifier, CSharpActivityDescriptorModifier>();
 39
 40        // Handlers.
 041        services.AddNotificationHandlersFrom<CSharpFeature>();
 42
 43        // UI property handlers.
 044        services.AddScoped<IPropertyUIHandler, RunCSharpOptionsProvider>();
 045    }
 46}
 47