< Summary

Class:Azure.ResourceManager.Compute.Models.SubResource
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\SubResource.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\SubResource.Serialization.cs
Covered lines:18
Uncovered lines:0
Coverable lines:18
Total lines:72
Line coverage:100% (18 of 18)
Covered branches:8
Total branches:8
Branch coverage:100% (8 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Id()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeSubResource(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\SubResource.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
 8namespace Azure.ResourceManager.Compute.Models
 9{
 10    /// <summary> The SubResource. </summary>
 11    public partial class SubResource
 12    {
 13        /// <summary> Initializes a new instance of SubResource. </summary>
 78414        public SubResource()
 15        {
 78416        }
 17
 18        /// <summary> Initializes a new instance of SubResource. </summary>
 19        /// <param name="id"> Resource Id. </param>
 917620        internal SubResource(string id)
 21        {
 917622            Id = id;
 917623        }
 24
 25        /// <summary> Resource Id. </summary>
 1155226        public string Id { get; set; }
 27    }
 28}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\SubResource.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.Compute.Models
 12{
 13    public partial class SubResource : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 8017            writer.WriteStartObject();
 8018            if (Id != null)
 19            {
 8020                writer.WritePropertyName("id");
 8021                writer.WriteStringValue(Id);
 22            }
 8023            writer.WriteEndObject();
 8024        }
 25
 26        internal static SubResource DeserializeSubResource(JsonElement element)
 27        {
 9228            string id = default;
 36829            foreach (var property in element.EnumerateObject())
 30            {
 9231                if (property.NameEquals("id"))
 32                {
 9233                    if (property.Value.ValueKind == JsonValueKind.Null)
 34                    {
 35                        continue;
 36                    }
 9237                    id = property.Value.GetString();
 38                    continue;
 39                }
 40            }
 9241            return new SubResource(id);
 42        }
 43    }
 44}