< Summary

Information
Class: Elsa.Workflows.Api.Endpoints.ActivityDescriptors.Get.Get
Assembly: Elsa.Workflows.Api
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Api/Endpoints/ActivityDescriptors/Get/Endpoint.cs
Line coverage
54%
Covered lines: 6
Uncovered lines: 5
Coverable lines: 11
Total lines: 35
Line coverage: 54.5%
Branch coverage
0%
Covered branches: 0
Total branches: 4
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%2040%

File(s)

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

#LineLine coverage
 1using Elsa.Abstractions;
 2using Elsa.Workflows.Models;
 3using JetBrains.Annotations;
 4
 5namespace Elsa.Workflows.Api.Endpoints.ActivityDescriptors.Get;
 6
 7[PublicAPI]
 8internal class Get : ElsaEndpoint<Request, ActivityDescriptor>
 9{
 10    private readonly IActivityRegistryLookupService _registryLookup;
 11
 12    /// <inheritdoc />
 113    public Get(IActivityRegistryLookupService registryLookup)
 14    {
 115        _registryLookup = registryLookup;
 116    }
 17
 18    /// <inheritdoc />
 19    public override void Configure()
 20    {
 121        Get("/descriptors/activities/{typeName}");
 122        ConfigurePermissions("read:*", "read:activity-descriptors");
 123    }
 24
 25    /// <inheritdoc />
 26    public override async Task HandleAsync(Request request, CancellationToken cancellationToken)
 27    {
 028        var descriptor = request.Version == null ? await _registryLookup.FindAsync(request.TypeName) : await _registryLo
 29
 030        if (descriptor == null)
 031            await Send.NotFoundAsync(cancellationToken);
 32        else
 033            await Send.OkAsync(descriptor, cancellationToken);
 034    }
 35}