< Summary

Information
Class: Elsa.Labels.Endpoints.Labels.Get.Get
Assembly: Elsa.Labels
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Labels/Endpoints/Labels/Get/Endpoint.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 12
Coverable lines: 12
Total lines: 33
Line coverage: 0%
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%210%
Configure()100%210%
HandleAsync()0%620%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Labels/Endpoints/Labels/Get/Endpoint.cs

#LineLine coverage
 1using Elsa.Labels.Contracts;
 2using FastEndpoints;
 3
 4namespace Elsa.Labels.Endpoints.Labels.Get;
 5
 6internal class Get : Endpoint<Request, Response, LabelMapper>
 7{
 8    private readonly ILabelStore _store;
 9
 010    public Get(ILabelStore store)
 11    {
 012        _store = store;
 013    }
 14
 15    public override void Configure()
 16    {
 017        Get("/labels/{id}");
 018        Policies(Constants.PolicyName);
 019    }
 20
 21    public override async Task HandleAsync(Request request, CancellationToken cancellationToken)
 22    {
 023        var label = await _store.FindByIdAsync(request.Id, cancellationToken);
 24
 025        if (label == null)
 026            await Send.NotFoundAsync(cancellationToken);
 27        else
 28        {
 029            var response = Map.FromEntity(label);
 030            await Send.OkAsync(response, cancellationToken);
 31        }
 032    }
 33}