< Summary

Class:Azure.ResourceManager.Resources.Models.ResourceLinkProperties
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ResourceLinkProperties.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ResourceLinkProperties.Serialization.cs
Covered lines:36
Uncovered lines:3
Coverable lines:39
Total lines:112
Line coverage:92.3% (36 of 39)
Covered branches:16
Total branches:18
Branch coverage:88.8% (16 of 18)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-80%50%
.ctor(...)-100%100%
get_SourceId()-100%100%
get_TargetId()-100%100%
get_Notes()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-81.82%75%
DeserializeResourceLinkProperties(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ResourceLinkProperties.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9
 10namespace Azure.ResourceManager.Resources.Models
 11{
 12    /// <summary> The resource link properties. </summary>
 13    public partial class ResourceLinkProperties
 14    {
 15        /// <summary> Initializes a new instance of ResourceLinkProperties. </summary>
 16        /// <param name="targetId"> The fully qualified ID of the target resource in the link. </param>
 417        public ResourceLinkProperties(string targetId)
 18        {
 419            if (targetId == null)
 20            {
 021                throw new ArgumentNullException(nameof(targetId));
 22            }
 23
 424            TargetId = targetId;
 425        }
 26
 27        /// <summary> Initializes a new instance of ResourceLinkProperties. </summary>
 28        /// <param name="sourceId"> The fully qualified ID of the source resource in the link. </param>
 29        /// <param name="targetId"> The fully qualified ID of the target resource in the link. </param>
 30        /// <param name="notes"> Notes about the resource link. </param>
 2431        internal ResourceLinkProperties(string sourceId, string targetId, string notes)
 32        {
 2433            SourceId = sourceId;
 2434            TargetId = targetId;
 2435            Notes = notes;
 2436        }
 37
 38        /// <summary> The fully qualified ID of the source resource in the link. </summary>
 2439        public string SourceId { get; }
 40        /// <summary> The fully qualified ID of the target resource in the link. </summary>
 5241        public string TargetId { get; set; }
 42        /// <summary> Notes about the resource link. </summary>
 5643        public string Notes { get; set; }
 44    }
 45}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ResourceLinkProperties.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Text.Json;
 9using Azure.Core;
 10
 11namespace Azure.ResourceManager.Resources.Models
 12{
 13    public partial class ResourceLinkProperties : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 417            writer.WriteStartObject();
 418            if (SourceId != null)
 19            {
 020                writer.WritePropertyName("sourceId");
 021                writer.WriteStringValue(SourceId);
 22            }
 423            writer.WritePropertyName("targetId");
 424            writer.WriteStringValue(TargetId);
 425            if (Notes != null)
 26            {
 427                writer.WritePropertyName("notes");
 428                writer.WriteStringValue(Notes);
 29            }
 430            writer.WriteEndObject();
 431        }
 32
 33        internal static ResourceLinkProperties DeserializeResourceLinkProperties(JsonElement element)
 34        {
 2435            string sourceId = default;
 2436            string targetId = default;
 2437            string notes = default;
 19238            foreach (var property in element.EnumerateObject())
 39            {
 7240                if (property.NameEquals("sourceId"))
 41                {
 2442                    if (property.Value.ValueKind == JsonValueKind.Null)
 43                    {
 44                        continue;
 45                    }
 2446                    sourceId = property.Value.GetString();
 2447                    continue;
 48                }
 4849                if (property.NameEquals("targetId"))
 50                {
 2451                    targetId = property.Value.GetString();
 2452                    continue;
 53                }
 2454                if (property.NameEquals("notes"))
 55                {
 2456                    if (property.Value.ValueKind == JsonValueKind.Null)
 57                    {
 58                        continue;
 59                    }
 2460                    notes = property.Value.GetString();
 61                    continue;
 62                }
 63            }
 2464            return new ResourceLinkProperties(sourceId, targetId, notes);
 65        }
 66    }
 67}