< Summary

Information
Class: Spdx3.Model.Core.Classes.CreationInfo
Assembly: Spdx3
File(s): /home/runner/work/Spdx3/Spdx3/Spdx3/Model/Core/Classes/CreationInfo.cs
Line coverage
100%
Covered lines: 18
Uncovered lines: 0
Coverable lines: 18
Total lines: 63
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Comment()100%11100%
get_Created()100%11100%
get_CreatedBy()100%11100%
get_CreatedUsing()100%11100%
get_SpecVersion()100%11100%
.ctor()100%11100%
.ctor(...)100%11100%
.ctor(...)100%11100%
Accept(...)100%11100%
Validate()100%11100%

File(s)

/home/runner/work/Spdx3/Spdx3/Spdx3/Model/Core/Classes/CreationInfo.cs

#LineLine coverage
 1using System.Diagnostics.CodeAnalysis;
 2using System.Text.Json.Serialization;
 3using Spdx3.Model.Lite;
 4using Spdx3.Serialization;
 5using Spdx3.Utility;
 6
 7namespace Spdx3.Model.Core.Classes;
 8
 9/// <summary>
 10///     Provides information about the creation of the Element.
 11///     See https://spdx.github.io/spdx-spec/v3.0.1/model/Core/Classes/CreationInfo/
 12/// </summary>
 13public class CreationInfo : BaseModelClass, ILiteDomainCompliantElement
 14{
 15    [JsonPropertyName("comment")]
 16    [JsonConverter(typeof(SpdxModelConverterFactory))]
 1417    public string? Comment { get; set; }
 18
 19    [JsonPropertyName("created")]
 20    [JsonConverter(typeof(SpdxModelConverterFactory))]
 26121    public required DateTimeOffset Created { get; set; }
 22
 23    [JsonPropertyName("createdBy")]
 24    [JsonConverter(typeof(SpdxModelConverterFactory))]
 54325    public IList<Agent> CreatedBy { get; } = new List<Agent>();
 26
 27    [JsonPropertyName("createdUsing")]
 28    [JsonConverter(typeof(SpdxModelConverterFactory))]
 30729    public IList<Tool> CreatedUsing { get; } = new List<Tool>();
 30
 31    [JsonPropertyName("specVersion")]
 32    [JsonConverter(typeof(SpdxModelConverterFactory))]
 31533    public string SpecVersion { get; set; } = "3.0.1";
 34
 35    // protected internal no-parm constructor required for deserialization
 36    // ReSharper disable once UnusedMember.Global
 5837    protected internal CreationInfo()
 38    {
 5839    }
 40
 41    [SetsRequiredMembers]
 142    public CreationInfo(Catalog catalog) : base(catalog)
 43    {
 144        Created = DateTimeOffset.UtcNow;
 145    }
 46
 47    [SetsRequiredMembers]
 23148    public CreationInfo(Catalog catalog, DateTimeOffset created) : base(catalog)
 49    {
 23150        Created = created;
 23151    }
 52
 53    public void Accept(ILiteDomainComplianceVisitor visitor)
 54    {
 355        visitor.Visit(this);
 356    }
 57
 58    public override void Validate()
 59    {
 360        base.Validate();
 261        ValidateRequiredProperty(nameof(CreatedBy));
 262    }
 63}