< Summary

Information
Class: Elsa.Labels.Endpoints.Labels.Post.LabelMapper
Assembly: Elsa.Labels
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Labels/Endpoints/Labels/Post/Mappers.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 14
Coverable lines: 14
Total lines: 24
Line coverage: 0%
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
ToEntity(...)0%2040%
FromEntity(...)100%210%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Labels/Endpoints/Labels/Post/Mappers.cs

#LineLine coverage
 1using Elsa.Labels.Entities;
 2using Elsa.Workflows;
 3using FastEndpoints;
 4
 5namespace Elsa.Labels.Endpoints.Labels.Post;
 6
 7internal class LabelMapper : Mapper<Request, Response, Label>
 8{
 09    public override Label ToEntity(Request request) => new()
 010    {
 011        Id = Resolve<IIdentityGenerator>().GenerateId(),
 012        Name = request.Name.Trim(),
 013        Description = request.Description?.Trim(),
 014        Color = request.Color?.Trim()
 015    };
 16
 017    public override Response FromEntity(Label e) => new()
 018    {
 019        Id = e.Id,
 020        Color = e.Color,
 021        Description = e.Description,
 022        NormalizedName = e.NormalizedName
 023    };
 24}