< Summary

Class:Azure.ResourceManager.Storage.Models.VirtualNetworkRule
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\VirtualNetworkRule.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\VirtualNetworkRule.Serialization.cs
Covered lines:20
Uncovered lines:20
Coverable lines:40
Total lines:113
Line coverage:50% (20 of 40)
Covered branches:12
Total branches:18
Branch coverage:66.6% (12 of 18)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%100%
get_VirtualNetworkResourceId()-0%100%
get_Action()-0%100%
get_State()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeVirtualNetworkRule(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\VirtualNetworkRule.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.Storage.Models
 11{
 12    /// <summary> Virtual Network rule. </summary>
 13    public partial class VirtualNetworkRule
 14    {
 15        /// <summary> Initializes a new instance of VirtualNetworkRule. </summary>
 16        /// <param name="virtualNetworkResourceId"> Resource ID of a subnet, for example: /subscriptions/{subscriptionId
 017        public VirtualNetworkRule(string virtualNetworkResourceId)
 18        {
 019            if (virtualNetworkResourceId == null)
 20            {
 021                throw new ArgumentNullException(nameof(virtualNetworkResourceId));
 22            }
 23
 024            VirtualNetworkResourceId = virtualNetworkResourceId;
 025            Action = "Allow";
 026        }
 27
 28        /// <summary> Initializes a new instance of VirtualNetworkRule. </summary>
 29        /// <param name="virtualNetworkResourceId"> Resource ID of a subnet, for example: /subscriptions/{subscriptionId
 30        /// <param name="action"> The action of virtual network rule. </param>
 31        /// <param name="state"> Gets the state of virtual network rule. </param>
 1632        internal VirtualNetworkRule(string virtualNetworkResourceId, string action, State? state)
 33        {
 1634            VirtualNetworkResourceId = virtualNetworkResourceId;
 1635            Action = action;
 1636            State = state;
 1637        }
 38
 39        /// <summary> Resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/p
 040        public string VirtualNetworkResourceId { get; set; }
 41        /// <summary> The action of virtual network rule. </summary>
 042        public string Action { get; set; }
 43        /// <summary> Gets the state of virtual network rule. </summary>
 044        public State? State { get; set; }
 45    }
 46}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\VirtualNetworkRule.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.Storage.Models
 12{
 13    public partial class VirtualNetworkRule : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            writer.WritePropertyName("id");
 019            writer.WriteStringValue(VirtualNetworkResourceId);
 020            if (Action != null)
 21            {
 022                writer.WritePropertyName("action");
 023                writer.WriteStringValue(Action);
 24            }
 025            if (State != null)
 26            {
 027                writer.WritePropertyName("state");
 028                writer.WriteStringValue(State.Value.ToSerialString());
 29            }
 030            writer.WriteEndObject();
 031        }
 32
 33        internal static VirtualNetworkRule DeserializeVirtualNetworkRule(JsonElement element)
 34        {
 1635            string id = default;
 1636            string action = default;
 1637            State? state = default;
 12838            foreach (var property in element.EnumerateObject())
 39            {
 4840                if (property.NameEquals("id"))
 41                {
 1642                    id = property.Value.GetString();
 1643                    continue;
 44                }
 3245                if (property.NameEquals("action"))
 46                {
 1647                    if (property.Value.ValueKind == JsonValueKind.Null)
 48                    {
 49                        continue;
 50                    }
 1651                    action = property.Value.GetString();
 1652                    continue;
 53                }
 1654                if (property.NameEquals("state"))
 55                {
 1656                    if (property.Value.ValueKind == JsonValueKind.Null)
 57                    {
 58                        continue;
 59                    }
 1660                    state = property.Value.GetString().ToState();
 61                    continue;
 62                }
 63            }
 1664            return new VirtualNetworkRule(id, action, state);
 65        }
 66    }
 67}