< Summary

Information
Class: Elsa.Secrets.Models.Secret
Assembly: Elsa.Secrets
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Secrets/Models/Secret.cs
Line coverage
100%
Covered lines: 18
Uncovered lines: 0
Coverable lines: 18
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
.ctor()100%11100%
get_Name()100%11100%
get_DisplayName()100%11100%
get_Description()100%11100%
get_TypeName()100%11100%
get_StoreName()100%11100%
get_Scope()100%11100%
get_Tags()100%11100%
get_Status()100%11100%
get_CreatedAt()100%11100%
get_UpdatedAt()100%11100%
get_Versions()100%11100%
get_LatestActiveVersion()100%22100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Secrets/Models/Secret.cs

#LineLine coverage
 1using Elsa.Common.Entities;
 2
 3namespace Elsa.Secrets.Models;
 4
 5public class Secret : Entity
 6{
 7    /// <summary>
 8    /// Assigns the identifier the property initializer used to provide.
 9    /// </summary>
 10    /// <remarks>
 11    /// <see cref="Entity.Id"/> is declared <c>null!</c>, and nothing in this module assigns a secret's id --
 12    /// there is no identity generator on the create path, so the initializer this replaces was load-bearing.
 13    /// Dropping it while deriving would have produced a null id on every insert, which unit tests that build
 14    /// a Secret by hand would not have noticed.
 15    /// </remarks>
 16016    public Secret()
 17    {
 16018        Id = Guid.NewGuid().ToString("N");
 16019    }
 20
 38521    public string Name { get; set; } = default!;
 26522    public string DisplayName { get; set; } = default!;
 23623    public string? Description { get; set; }
 40224    public string TypeName { get; set; } = SecretTypeNames.Text;
 41425    public string StoreName { get; set; } = SecretStoreNames.Encrypted;
 23626    public string? Scope { get; set; }
 27    [System.Text.Json.Serialization.JsonConverter(typeof(CaseInsensitiveHashSetConverter))]
 40428    public HashSet<string> Tags { get; set; } = new(StringComparer.OrdinalIgnoreCase);
 28929    public SecretStatus Status { get; set; } = SecretStatus.Active;
 35330    public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
 20531    public DateTimeOffset? UpdatedAt { get; set; }
 45932    public IList<SecretVersion> Versions { get; set; } = [];
 33
 2034    public SecretVersion? LatestActiveVersion => Versions
 1635        .Where(x => x.Status == SecretStatus.Active && !x.IsExpired())
 1236        .OrderByDescending(x => x.Version)
 2037        .FirstOrDefault();
 38}