< Summary

Class:Azure.ResourceManager.Network.Models.NetworkWatcher
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\NetworkWatcher.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\NetworkWatcher.Serialization.cs
Covered lines:58
Uncovered lines:24
Coverable lines:82
Total lines:202
Line coverage:70.7% (58 of 82)
Covered branches:40
Total branches:54
Branch coverage:74% (40 of 54)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Etag()-100%100%
get_ProvisioningState()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-48.39%50%
DeserializeNetworkWatcher(...)-81.4%84.21%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\NetworkWatcher.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.Collections.Generic;
 9
 10namespace Azure.ResourceManager.Network.Models
 11{
 12    /// <summary> Network watcher in a resource group. </summary>
 13    public partial class NetworkWatcher : Resource
 14    {
 15        /// <summary> Initializes a new instance of NetworkWatcher. </summary>
 416        public NetworkWatcher()
 17        {
 418        }
 19
 20        /// <summary> Initializes a new instance of NetworkWatcher. </summary>
 21        /// <param name="id"> Resource ID. </param>
 22        /// <param name="name"> Resource name. </param>
 23        /// <param name="type"> Resource type. </param>
 24        /// <param name="location"> Resource location. </param>
 25        /// <param name="tags"> Resource tags. </param>
 26        /// <param name="etag"> A unique read-only string that changes whenever the resource is updated. </param>
 27        /// <param name="provisioningState"> The provisioning state of the network watcher resource. </param>
 6428        internal NetworkWatcher(string id, string name, string type, string location, IDictionary<string, string> tags, 
 29        {
 6430            Etag = etag;
 6431            ProvisioningState = provisioningState;
 6432        }
 33
 34        /// <summary> A unique read-only string that changes whenever the resource is updated. </summary>
 435        public string Etag { get; }
 36        /// <summary> The provisioning state of the network watcher resource. </summary>
 837        public ProvisioningState? ProvisioningState { get; }
 38    }
 39}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\NetworkWatcher.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.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.Network.Models
 13{
 14    public partial class NetworkWatcher : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 418            writer.WriteStartObject();
 419            if (Etag != null)
 20            {
 021                writer.WritePropertyName("etag");
 022                writer.WriteStringValue(Etag);
 23            }
 424            if (Id != null)
 25            {
 026                writer.WritePropertyName("id");
 027                writer.WriteStringValue(Id);
 28            }
 429            if (Name != null)
 30            {
 031                writer.WritePropertyName("name");
 032                writer.WriteStringValue(Name);
 33            }
 434            if (Type != null)
 35            {
 036                writer.WritePropertyName("type");
 037                writer.WriteStringValue(Type);
 38            }
 439            if (Location != null)
 40            {
 441                writer.WritePropertyName("location");
 442                writer.WriteStringValue(Location);
 43            }
 444            if (Tags != null)
 45            {
 046                writer.WritePropertyName("tags");
 047                writer.WriteStartObject();
 048                foreach (var item in Tags)
 49                {
 050                    writer.WritePropertyName(item.Key);
 051                    writer.WriteStringValue(item.Value);
 52                }
 053                writer.WriteEndObject();
 54            }
 455            writer.WritePropertyName("properties");
 456            writer.WriteStartObject();
 457            if (ProvisioningState != null)
 58            {
 059                writer.WritePropertyName("provisioningState");
 060                writer.WriteStringValue(ProvisioningState.Value.ToString());
 61            }
 462            writer.WriteEndObject();
 463            writer.WriteEndObject();
 464        }
 65
 66        internal static NetworkWatcher DeserializeNetworkWatcher(JsonElement element)
 67        {
 6468            string etag = default;
 6469            string id = default;
 6470            string name = default;
 6471            string type = default;
 6472            string location = default;
 6473            IDictionary<string, string> tags = default;
 6474            ProvisioningState? provisioningState = default;
 89675            foreach (var property in element.EnumerateObject())
 76            {
 38477                if (property.NameEquals("etag"))
 78                {
 6479                    if (property.Value.ValueKind == JsonValueKind.Null)
 80                    {
 81                        continue;
 82                    }
 6483                    etag = property.Value.GetString();
 6484                    continue;
 85                }
 32086                if (property.NameEquals("id"))
 87                {
 6488                    if (property.Value.ValueKind == JsonValueKind.Null)
 89                    {
 90                        continue;
 91                    }
 6492                    id = property.Value.GetString();
 6493                    continue;
 94                }
 25695                if (property.NameEquals("name"))
 96                {
 6497                    if (property.Value.ValueKind == JsonValueKind.Null)
 98                    {
 99                        continue;
 100                    }
 64101                    name = property.Value.GetString();
 64102                    continue;
 103                }
 192104                if (property.NameEquals("type"))
 105                {
 64106                    if (property.Value.ValueKind == JsonValueKind.Null)
 107                    {
 108                        continue;
 109                    }
 64110                    type = property.Value.GetString();
 64111                    continue;
 112                }
 128113                if (property.NameEquals("location"))
 114                {
 64115                    if (property.Value.ValueKind == JsonValueKind.Null)
 116                    {
 117                        continue;
 118                    }
 64119                    location = property.Value.GetString();
 64120                    continue;
 121                }
 64122                if (property.NameEquals("tags"))
 123                {
 0124                    if (property.Value.ValueKind == JsonValueKind.Null)
 125                    {
 126                        continue;
 127                    }
 0128                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 0129                    foreach (var property0 in property.Value.EnumerateObject())
 130                    {
 0131                        if (property0.Value.ValueKind == JsonValueKind.Null)
 132                        {
 0133                            dictionary.Add(property0.Name, null);
 134                        }
 135                        else
 136                        {
 0137                            dictionary.Add(property0.Name, property0.Value.GetString());
 138                        }
 139                    }
 0140                    tags = dictionary;
 0141                    continue;
 142                }
 64143                if (property.NameEquals("properties"))
 144                {
 384145                    foreach (var property0 in property.Value.EnumerateObject())
 146                    {
 128147                        if (property0.NameEquals("provisioningState"))
 148                        {
 64149                            if (property0.Value.ValueKind == JsonValueKind.Null)
 150                            {
 151                                continue;
 152                            }
 64153                            provisioningState = new ProvisioningState(property0.Value.GetString());
 154                            continue;
 155                        }
 156                    }
 157                    continue;
 158                }
 159            }
 64160            return new NetworkWatcher(id, name, type, location, tags, etag, provisioningState);
 161        }
 162    }
 163}