< Summary

Information
Class: Elsa.Workflows.Api.Endpoints.Features.List.List
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/Features/List/Endpoint.cs
Line coverage
66%
Covered lines: 6
Uncovered lines: 3
Coverable lines: 9
Total lines: 38
Line coverage: 66.6%
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%
Configure()100%11100%
ExecuteAsync(...)100%210%

File(s)

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

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Features.Contracts;
 3using Elsa.Features.Models;
 4using Elsa.Models;
 5using JetBrains.Annotations;
 6
 7namespace Elsa.Workflows.Api.Endpoints.Features.List;
 8
 9/// <summary>
 10/// Returns a list of installed features.
 11/// </summary>
 12[PublicAPI]
 13internal class List : ElsaEndpointWithoutRequest<ListResponse<FeatureDescriptor>>
 14{
 15    private readonly IInstalledFeatureRegistry _installedFeatureRegistry;
 16
 17    /// <inheritdoc />
 118    public List(IInstalledFeatureRegistry installedFeatureRegistry)
 19    {
 120        _installedFeatureRegistry = installedFeatureRegistry;
 121    }
 22
 23    /// <inheritdoc />
 24    public override void Configure()
 25    {
 126        Get("/features/installed");
 127        ConfigurePermissions("read:*", "read:installed-features");
 128    }
 29
 30    /// <inheritdoc />
 31    public override Task<ListResponse<FeatureDescriptor>> ExecuteAsync(CancellationToken cancellationToken)
 32    {
 033        var descriptors = _installedFeatureRegistry.List().ToList();
 034        var response = new ListResponse<FeatureDescriptor>(descriptors);
 35
 036        return Task.FromResult(response);
 37    }
 38}