< Summary

Information
Class: Elsa.WorkflowProviders.BlobStorage.Features.BlobStorageFeature
Assembly: Elsa.WorkflowProviders.BlobStorage
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.WorkflowProviders.BlobStorage/Features/BlobStorageFeature.cs
Line coverage
70%
Covered lines: 7
Uncovered lines: 3
Coverable lines: 10
Total lines: 53
Line coverage: 70%
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_BlobStorage()100%11100%
Apply()100%11100%
GetDefaultWorkflowsDirectory()100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.WorkflowProviders.BlobStorage/Features/BlobStorageFeature.cs

#LineLine coverage
 1using System.Reflection;
 2using Elsa.Features.Abstractions;
 3using Elsa.Features.Attributes;
 4using Elsa.Features.Services;
 5using Elsa.WorkflowProviders.BlobStorage.Contracts;
 6using Elsa.WorkflowProviders.BlobStorage.Handlers;
 7using Elsa.WorkflowProviders.BlobStorage.Providers;
 8using Elsa.Workflows.Management.Features;
 9using FluentStorage;
 10using FluentStorage.Blobs;
 11using Microsoft.Extensions.DependencyInjection;
 12
 13namespace Elsa.WorkflowProviders.BlobStorage.Features;
 14
 15/// <summary>
 16/// A feature that enables the FluentStorage workflow definition provider.
 17/// </summary>
 18[DependsOn(typeof(WorkflowManagementFeature))]
 19public class BlobStorageFeature : FeatureBase
 20{
 21    /// <inheritdoc />
 122    public BlobStorageFeature(IModule module) : base(module)
 23    {
 124    }
 25
 26    /// <summary>
 27    /// The blob storage to use.
 28    /// </summary>
 26829    public Func<IServiceProvider, IBlobStorage> BlobStorage { get; set; } = _ => StorageFactory.Blobs.DirectoryFiles(Get
 30
 31    /// <inheritdoc />
 32    public override void Apply()
 33    {
 26734        Services.AddScoped<IBlobStorageProvider>(sp => new BlobStorageProvider(BlobStorage(sp)));
 35
 36        // Register the JSON format handler (built-in support)
 137        Services.AddScoped<IBlobWorkflowFormatHandler, JsonBlobWorkflowFormatHandler>();
 38
 139        Services.AddWorkflowsProvider<BlobStorageWorkflowsProvider>();
 140    }
 41
 42    /// <summary>
 43    /// Gets the default workflows directory.
 44    /// </summary>
 45    /// <returns>The default workflows directory.</returns>
 46    public static string GetDefaultWorkflowsDirectory()
 47    {
 048        var entryAssemblyDir = Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location)!;
 049        var directory = Path.Combine(entryAssemblyDir, "Workflows");
 050        return directory;
 51    }
 52
 53}