< Summary

Information
Class: Elsa.Workflows.Api.Endpoints.Features.Get.Get
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/Features/Get/Endpoint.cs
Line coverage
46%
Covered lines: 6
Uncovered lines: 7
Coverable lines: 13
Total lines: 43
Line coverage: 46.1%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Configure()100%11100%
HandleAsync()0%620%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/Features/Get/Endpoint.cs

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Features.Contracts;
 3using Elsa.Features.Models;
 4using JetBrains.Annotations;
 5
 6namespace Elsa.Workflows.Api.Endpoints.Features.Get;
 7
 8/// <summary>
 9/// Returns the specified installed feature.
 10/// </summary>
 11[PublicAPI]
 12internal class Get : ElsaEndpointWithoutRequest<FeatureDescriptor>
 13{
 14    private readonly IInstalledFeatureRegistry _installedFeatureRegistry;
 15
 16    /// <inheritdoc />
 117    public Get(IInstalledFeatureRegistry installedFeatureRegistry)
 18    {
 119        _installedFeatureRegistry = installedFeatureRegistry;
 120    }
 21
 22    /// <inheritdoc />
 23    public override void Configure()
 24    {
 125        Get("/features/installed/{fullName}");
 126        ConfigurePermissions("read:*", "read:installed-features");
 127    }
 28
 29    /// <inheritdoc />
 30    public override async Task HandleAsync( CancellationToken cancellationToken)
 31    {
 032        var fullName = Route<string>("fullName")!;
 033        var descriptor = _installedFeatureRegistry.Find(fullName);
 34
 035        if (descriptor == null)
 36        {
 037            await Send.NotFoundAsync(cancellationToken);
 038            return;
 39        }
 40
 041        await Send.OkAsync(descriptor, cancellationToken);
 042    }
 43}