< 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
36%
Covered lines: 4
Uncovered lines: 7
Coverable lines: 11
Total lines: 36
Line coverage: 36.3%
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.Authorization;
 2using Elsa.Abstractions;
 3using Elsa.Features.Contracts;
 4using Elsa.Features.Models;
 5using JetBrains.Annotations;
 6
 7namespace Elsa.Workflows.Api.Endpoints.Features.Get;
 8
 9/// <summary>
 10/// Returns the specified installed feature.
 11/// </summary>
 12[PublicAPI]
 313internal class Get(IInstalledFeatureProvider installedFeatureProvider) : ElsaEndpointWithoutRequest<FeatureDescriptor>
 14{
 15    /// <inheritdoc />
 16    public override void Configure()
 17    {
 318        Get("/features/installed/{fullName}");
 319        RequirePermission(Elsa.Workflows.Api.Permissions.WorkflowPermissions.SystemFeatures, CoreVerbs.View);
 320    }
 21
 22    /// <inheritdoc />
 23    public override async Task HandleAsync( CancellationToken cancellationToken)
 24    {
 025        var fullName = Route<string>("fullName")!;
 026        var descriptor = installedFeatureProvider.Find(fullName);
 27
 028        if (descriptor == null)
 29        {
 030            await Send.NotFoundAsync(cancellationToken);
 031            return;
 32        }
 33
 034        await Send.OkAsync(descriptor, cancellationToken);
 035    }
 36}