< Summary

Information
Class: Elsa.Workflows.Api.Endpoints.ActivityDescriptors.List.List
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/ActivityDescriptors/List/Endpoint.cs
Line coverage
36%
Covered lines: 4
Uncovered lines: 7
Coverable lines: 11
Total lines: 28
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%
ExecuteAsync()0%620%

File(s)

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

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Workflows.Management;
 3using JetBrains.Annotations;
 4
 5namespace Elsa.Workflows.Api.Endpoints.ActivityDescriptors.List;
 6
 7[PublicAPI]
 18internal class List(IActivityRegistry registry, IActivityRegistryPopulator registryPopulator) : ElsaEndpointWithoutReque
 9{
 10    public override void Configure()
 11    {
 112        Get("/descriptors/activities");
 113        ConfigurePermissions("read:*", "read:activity-descriptors");
 114    }
 15
 16    public override async Task<Response> ExecuteAsync(CancellationToken cancellationToken)
 17    {
 018        var forceRefresh = Query<bool>("refresh", false);
 19
 020        if (forceRefresh)
 021            await registryPopulator.PopulateRegistryAsync(cancellationToken);
 22
 023        var descriptors = registry.ListAll().ToList();
 024        var response = new Response(descriptors);
 25
 026        return response;
 027    }
 28}