< Summary

Information
Class: Elsa.Labels.Entities.Label
Assembly: Elsa.Labels
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Labels/Entities/Label.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 38
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Name()100%11100%
set_Name(...)100%22100%
get_NormalizedName()100%11100%
get_Description()100%11100%
get_Color()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Labels/Entities/Label.cs

#LineLine coverage
 1using Elsa.Common.Entities;
 2
 3namespace Elsa.Labels.Entities;
 4
 5/// <summary>
 6/// Represents an individual label.
 7/// </summary>
 8public class Label : Entity
 9{
 10    /// <summary>
 11    /// Shared maximum for <see cref="Name"/> and <see cref="NormalizedName"/>.
 12    /// Matches the MySQL unique-index limit that every provider's schema must honor.
 13    /// </summary>
 14    public const int NameMaxLength = 255;
 15
 16    private string _name = default!;
 17
 18    public string Name
 19    {
 17420        get => _name;
 21        set
 22        {
 16223            if (value.Length > NameMaxLength)
 24            {
 125                throw new ArgumentException(
 126                    $"Label name cannot exceed {NameMaxLength} characters.",
 127                    nameof(Name));
 28            }
 29
 16130            _name = value;
 16131            NormalizedName = value.ToLowerInvariant();
 16132        }
 33    }
 34
 43435    public string NormalizedName { get; set; } = default!;
 11136    public string? Description { get; set; }
 11137    public string? Color { get; set; }
 38}