< Summary

Class:Azure.ResourceManager.Resources.Models.TemplateLink
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\TemplateLink.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\TemplateLink.Serialization.cs
Covered lines:28
Uncovered lines:1
Coverable lines:29
Total lines:93
Line coverage:96.5% (28 of 29)
Covered branches:11
Total branches:12
Branch coverage:91.6% (11 of 12)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-80%50%
.ctor(...)-100%100%
get_Uri()-100%100%
get_ContentVersion()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeTemplateLink(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\TemplateLink.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> Entity representing the reference to the template. </summary>
 13    public partial class TemplateLink
 14    {
 15        /// <summary> Initializes a new instance of TemplateLink. </summary>
 16        /// <param name="uri"> The URI of the template to deploy. </param>
 4417        public TemplateLink(string uri)
 18        {
 4419            if (uri == null)
 20            {
 021                throw new ArgumentNullException(nameof(uri));
 22            }
 23
 4424            Uri = uri;
 4425        }
 26
 27        /// <summary> Initializes a new instance of TemplateLink. </summary>
 28        /// <param name="uri"> The URI of the template to deploy. </param>
 29        /// <param name="contentVersion"> If included, must match the ContentVersion in the template. </param>
 4030        internal TemplateLink(string uri, string contentVersion)
 31        {
 4032            Uri = uri;
 4033            ContentVersion = contentVersion;
 4034        }
 35
 36        /// <summary> The URI of the template to deploy. </summary>
 19637        public string Uri { get; set; }
 38        /// <summary> If included, must match the ContentVersion in the template. </summary>
 22839        public string ContentVersion { get; set; }
 40    }
 41}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\TemplateLink.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 TemplateLink : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 8817            writer.WriteStartObject();
 8818            writer.WritePropertyName("uri");
 8819            writer.WriteStringValue(Uri);
 8820            if (ContentVersion != null)
 21            {
 5622                writer.WritePropertyName("contentVersion");
 5623                writer.WriteStringValue(ContentVersion);
 24            }
 8825            writer.WriteEndObject();
 8826        }
 27
 28        internal static TemplateLink DeserializeTemplateLink(JsonElement element)
 29        {
 4030            string uri = default;
 4031            string contentVersion = default;
 28832            foreach (var property in element.EnumerateObject())
 33            {
 10434                if (property.NameEquals("uri"))
 35                {
 4036                    uri = property.Value.GetString();
 4037                    continue;
 38                }
 6439                if (property.NameEquals("contentVersion"))
 40                {
 4041                    if (property.Value.ValueKind == JsonValueKind.Null)
 42                    {
 43                        continue;
 44                    }
 4045                    contentVersion = property.Value.GetString();
 46                    continue;
 47                }
 48            }
 4049            return new TemplateLink(uri, contentVersion);
 50        }
 51    }
 52}