< Summary

Information
Class: Spdx3.Model.ExpandedLicensing.Classes.ConjunctiveLicenseSet
Assembly: Spdx3
File(s): /home/runner/work/Spdx3/Spdx3/Spdx3/Model/ExpandedLicensing/Classes/ConjunctiveLicenseSet.cs
Line coverage
78%
Covered lines: 11
Uncovered lines: 3
Coverable lines: 14
Total lines: 52
Line coverage: 78.5%
Branch coverage
83%
Covered branches: 5
Total branches: 6
Branch coverage: 83.3%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Member()100%11100%
.ctor()100%210%
.ctor(...)75%4485.71%
Validate()100%22100%

File(s)

/home/runner/work/Spdx3/Spdx3/Spdx3/Model/ExpandedLicensing/Classes/ConjunctiveLicenseSet.cs

#LineLine coverage
 1using System.Diagnostics.CodeAnalysis;
 2using System.Text.Json.Serialization;
 3using Spdx3.Exceptions;
 4using Spdx3.Model.Core.Classes;
 5using Spdx3.Model.SimpleLicensing.Classes;
 6using Spdx3.Serialization;
 7using Spdx3.Utility;
 8
 9namespace Spdx3.Model.ExpandedLicensing.Classes;
 10
 11/// <summary>
 12/// Portion of an AnyLicenseInfo representing a set of licensing information where all elements apply.
 13/// See https://spdx.github.io/spdx-spec/v3.0.1/model/ExpandedLicensing/Classes/ConjunctiveLicenseSet/
 14/// </summary>
 15public class ConjunctiveLicenseSet : AnyLicenseInfo
 16{
 17    [JsonPropertyName("expandedlicensing_member")]
 18    [JsonConverter(typeof(SpdxModelConverterFactory))]
 2619    public IList<AnyLicenseInfo> Member { get; set; } = new List<AnyLicenseInfo>();
 20
 21    /// <summary>
 22    /// No-arg constructor required for serialization/deserialization
 23    /// </summary>
 024    protected internal ConjunctiveLicenseSet()
 25    {
 026    }
 27
 28    [SetsRequiredMembers]
 529    public ConjunctiveLicenseSet(Catalog catalog, CreationInfo creationInfo, IList<AnyLicenseInfo> licenses) : base(
 530        catalog, creationInfo)
 31    {
 532        if (licenses.Count < 2)
 33        {
 034            throw new Spdx3Exception("ConjunctiveLicenseSets must have at least 2 licenses.");
 35        }
 36
 3237        foreach (var anyLicenseInfo in licenses)
 38        {
 1139            Member.Add(anyLicenseInfo);
 40        }
 541    }
 42
 43    public override void Validate()
 44    {
 345        base.Validate();
 46
 347        if (Member.Count < 2)
 48        {
 149            throw new Spdx3ValidationException("ConjunctiveLicenseSets must have at least 2 licenses.");
 50        }
 251    }
 52}