< Summary

Information
Class: Elsa.Labels.Endpoints.Labels.Update.LabelMapper
Assembly: Elsa.Labels
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Labels/Endpoints/Labels/Update/Mappers.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 19
Coverable lines: 19
Total lines: 32
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 8
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%
UpdateEntity(...)0%2040%

File(s)

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

#LineLine coverage
 1using Elsa.Labels.Entities;
 2using FastEndpoints;
 3
 4namespace Elsa.Labels.Endpoints.Labels.Update;
 5
 6internal class LabelMapper : Mapper<Request, Response, Label>
 7{
 08    public override Label ToEntity(Request request) => new()
 09    {
 010        Id = request.Id,
 011        Name = request.Name.Trim(),
 012        Description = request.Description?.Trim(),
 013        Color = request.Color?.Trim()
 014    };
 15
 016    public override Response FromEntity(Label e) => new Response
 017    {
 018        Id = e.Id,
 019        Color = e.Color,
 020        Description = e.Description,
 021        NormalizedName = e.NormalizedName
 022    };
 23
 24    public override Label UpdateEntity(Request r, Label e)
 25    {
 026        e.Color = r.Color?.Trim();
 027        e.Description = r.Description?.Trim();
 028        e.Name = r.Name.Trim();
 029        e.NormalizedName = r.Name.ToLowerInvariant();
 030        return e;
 31    }
 32}