< Summary

Information
Class: Spdx3.Model.Core.Classes.Annotation
Assembly: Spdx3
File(s): /home/runner/work/Spdx3/Spdx3/Spdx3/Model/Core/Classes/Annotation.cs
Line coverage
100%
Covered lines: 14
Uncovered lines: 0
Coverable lines: 14
Total lines: 51
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_Subject()100%11100%
get_AnnotationType()100%11100%
get_Statement()100%11100%
get_ContentType()100%11100%
.ctor()100%11100%
.ctor(...)100%11100%
Validate()100%11100%

File(s)

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

#LineLine coverage
 1using System.Diagnostics.CodeAnalysis;
 2using System.Text.Json.Serialization;
 3using Spdx3.Model.Core.Enums;
 4using Spdx3.Serialization;
 5using Spdx3.Utility;
 6
 7namespace Spdx3.Model.Core.Classes;
 8
 9/// <summary>
 10///     An assertion made in relation to one or more elements.
 11///     See https://spdx.github.io/spdx-spec/v3.0.1/model/Core/Classes/Annotation/
 12/// </summary>
 13public class Annotation : Element
 14{
 15    [JsonPropertyName("subject")]
 16    [JsonConverter(typeof(SpdxModelConverterFactory))]
 1717    public required Element Subject { get; set; }
 18
 19    [JsonPropertyName("annotationType")]
 20    [JsonConverter(typeof(SpdxModelConverterFactory))]
 1521    public required AnnotationType AnnotationType { get; set; }
 22
 23    [JsonPropertyName("statement")]
 24    [JsonConverter(typeof(SpdxModelConverterFactory))]
 725    public string? Statement { get; set; }
 26
 27    [JsonPropertyName("contentType")]
 28    [JsonConverter(typeof(SpdxModelConverterFactory))]
 729    public string? ContentType { get; set; }
 30
 31    // protected internal no-parm constructor required for deserialization
 32    // ReSharper disable once UnusedMember.Global
 233    protected internal Annotation()
 34    {
 235    }
 36
 37    [SetsRequiredMembers]
 38    public Annotation(Catalog catalog, CreationInfo creationInfo, AnnotationType annotationType, Element subject) :
 439        base(catalog, creationInfo)
 40    {
 441        AnnotationType = annotationType;
 442        Subject = subject;
 443    }
 44
 45    public override void Validate()
 46    {
 547        base.Validate();
 348        ValidateRequiredProperty(nameof(AnnotationType));
 349        ValidateRequiredProperty(nameof(Subject));
 350    }
 51}