< Summary

Information
Class: Spdx3.Model.Extension.Classes.CdxPropertiesExtension
Assembly: Spdx3
File(s): /home/runner/work/Spdx3/Spdx3/Spdx3/Model/Extension/Classes/CdxPropertiesExtension.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 41
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
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_CdxProperty()100%11100%
.ctor()100%11100%
.ctor(...)100%22100%
Validate()100%22100%

File(s)

/home/runner/work/Spdx3/Spdx3/Spdx3/Model/Extension/Classes/CdxPropertiesExtension.cs

#LineLine coverage
 1using System.Diagnostics.CodeAnalysis;
 2using System.Text.Json.Serialization;
 3using Spdx3.Exceptions;
 4using Spdx3.Serialization;
 5using Spdx3.Utility;
 6
 7namespace Spdx3.Model.Extension.Classes;
 8
 9public class CdxPropertiesExtension : Extension
 10{
 11    [JsonPropertyName("extension_cdxProperty")]
 12    [JsonConverter(typeof(SpdxModelConverterFactory))]
 1613    public IList<CdxPropertyEntry> CdxProperty { get; init; } = new List<CdxPropertyEntry>();
 14
 15    // protected internal no-parm constructor required for deserialization
 16    // ReSharper disable once UnusedMember.Global
 217    protected internal CdxPropertiesExtension()
 18    {
 219    }
 20
 21    [SetsRequiredMembers]
 322    public CdxPropertiesExtension(Catalog catalog, IList<CdxPropertyEntry> cdxProperties) : base(catalog)
 23    {
 324        if (cdxProperties.Count == 0)
 25        {
 126            throw new Spdx3ValidationException(this, nameof(CdxProperty), "Collection cannot be empty.");
 27        }
 28
 229        CdxProperty = cdxProperties;
 230    }
 31
 32    public override void Validate()
 33    {
 334        base.Validate();
 35
 236        if (CdxProperty.Count == 0)
 37        {
 138            throw new Spdx3ValidationException(this, nameof(CdxProperty), "Collection cannot be empty.");
 39        }
 140    }
 41}