< Summary

Information
Class: Elsa.Alterations.ShellFeatures.AlterationsFeature
Assembly: Elsa.Alterations
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Alterations/ShellFeatures/AlterationsFeature.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 16
Coverable lines: 16
Total lines: 56
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_AlterationPlanStoreFactory()100%210%
get_AlterationJobStoreFactory()100%210%
get_AlterationJobDispatcherFactory()100%210%
ConfigureServices(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Alterations/ShellFeatures/AlterationsFeature.cs

#LineLine coverage
 1using CShells.Features;
 2using Elsa.Alterations.Core.Contracts;
 3using Elsa.Alterations.Core.Entities;
 4using Elsa.Alterations.Core.Extensions;
 5using Elsa.Alterations.Core.Stores;
 6using Elsa.Alterations.Extensions;
 7using Elsa.Alterations.Services;
 8using Elsa.Extensions;
 9using JetBrains.Annotations;
 10using Microsoft.Extensions.DependencyInjection;
 11
 12namespace Elsa.Alterations.ShellFeatures;
 13
 14/// <summary>
 15/// Adds the Elsa alterations services.
 16/// </summary>
 17[ShellFeature(
 18    DisplayName = "Alterations",
 19    Description = "Provides workflow alteration capabilities for modifying running workflow instances")]
 20[UsedImplicitly]
 21public class AlterationsFeature : IShellFeature
 22{
 23    /// <summary>
 24    /// Gets or sets the factory for the alteration plan store.
 25    /// </summary>
 026    public Func<IServiceProvider, IAlterationPlanStore> AlterationPlanStoreFactory { get; set; } = sp => sp.GetRequiredS
 27
 28    /// <summary>
 29    /// Gets or sets the factory for the alteration job store.
 30    /// </summary>
 031    public Func<IServiceProvider, IAlterationJobStore> AlterationJobStoreFactory { get; set; } = sp => sp.GetRequiredSer
 32
 33    /// <summary>
 34    /// Gets or sets the factory for the alteration job dispatcher.
 35    /// </summary>
 036    public Func<IServiceProvider, IAlterationJobDispatcher> AlterationJobDispatcherFactory { get; set; } = sp => sp.GetR
 37
 38    public void ConfigureServices(IServiceCollection services)
 39    {
 040        services.AddScoped<IAlterationPlanManager, AlterationPlanManager>();
 041        services.AddAlterations();
 042        services.AddAlterationsCore();
 043        services.AddScoped<BackgroundAlterationJobDispatcher>();
 044        services.AddScoped<IAlterationPlanScheduler, DefaultAlterationPlanScheduler>();
 045        services.AddScoped<IAlterationJobRunner, DefaultAlterationJobRunner>();
 046        services.AddScoped<IAlterationRunner, DefaultAlterationRunner>();
 47
 048        services.AddMemoryStore<AlterationPlan, MemoryAlterationPlanStore>();
 049        services.AddMemoryStore<AlterationJob, MemoryAlterationJobStore>();
 50
 051        services.AddScoped(AlterationPlanStoreFactory);
 052        services.AddScoped(AlterationJobStoreFactory);
 053        services.AddScoped(AlterationJobDispatcherFactory);
 054    }
 55}
 56