< Summary

Class:Azure.ResourceManager.DigitalTwins.Models.DigitalTwinsDescription
Assembly:Azure.ResourceManager.DigitalTwins
File(s):C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\DigitalTwinsDescription.cs
C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\DigitalTwinsDescription.Serialization.cs
Covered lines:65
Uncovered lines:18
Coverable lines:83
Total lines:191
Line coverage:78.3% (65 of 83)
Covered branches:29
Total branches:40
Branch coverage:72.5% (29 of 40)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-75%50%
.ctor(...)-100%100%
get_CreatedTime()-100%100%
get_LastUpdatedTime()-100%100%
get_ProvisioningState()-100%100%
get_HostName()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-50%25%
DeserializeDigitalTwinsDescription(...)-85.71%86.67%

File(s)

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\DigitalTwinsDescription.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;
 9using System.Collections.Generic;
 10
 11namespace Azure.ResourceManager.DigitalTwins.Models
 12{
 13    /// <summary> The description of the DigitalTwins service. </summary>
 14    public partial class DigitalTwinsDescription : DigitalTwinsResource
 15    {
 16        /// <summary> Initializes a new instance of DigitalTwinsDescription. </summary>
 17        /// <param name="location"> The resource location. </param>
 18        /// <exception cref="ArgumentNullException"> <paramref name="location"/> is null. </exception>
 419        public DigitalTwinsDescription(string location) : base(location)
 20        {
 421            if (location == null)
 22            {
 023                throw new ArgumentNullException(nameof(location));
 24            }
 425        }
 26
 27        /// <summary> Initializes a new instance of DigitalTwinsDescription. </summary>
 28        /// <param name="id"> The resource identifier. </param>
 29        /// <param name="name"> The resource name. </param>
 30        /// <param name="type"> The resource type. </param>
 31        /// <param name="location"> The resource location. </param>
 32        /// <param name="tags"> The resource tags. </param>
 33        /// <param name="sku"> This property is reserved for future use, and will be ignored/omitted. </param>
 34        /// <param name="createdTime"> Time when DigitalTwinsInstance was created. </param>
 35        /// <param name="lastUpdatedTime"> Time when DigitalTwinsInstance was created. </param>
 36        /// <param name="provisioningState"> The provisioning state. </param>
 37        /// <param name="hostName"> Api endpoint to work with DigitalTwinsInstance. </param>
 4238        internal DigitalTwinsDescription(string id, string name, string type, string location, IDictionary<string, strin
 39        {
 4240            CreatedTime = createdTime;
 4241            LastUpdatedTime = lastUpdatedTime;
 4242            ProvisioningState = provisioningState;
 4243            HostName = hostName;
 4244        }
 45
 46        /// <summary> Time when DigitalTwinsInstance was created. </summary>
 1247        public DateTimeOffset? CreatedTime { get; }
 48        /// <summary> Time when DigitalTwinsInstance was created. </summary>
 1249        public DateTimeOffset? LastUpdatedTime { get; }
 50        /// <summary> The provisioning state. </summary>
 1251        public ProvisioningState? ProvisioningState { get; }
 52        /// <summary> Api endpoint to work with DigitalTwinsInstance. </summary>
 1253        public string HostName { get; }
 54    }
 55}

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\DigitalTwinsDescription.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;
 9using System.Collections.Generic;
 10using System.Text.Json;
 11using Azure.Core;
 12
 13namespace Azure.ResourceManager.DigitalTwins.Models
 14{
 15    public partial class DigitalTwinsDescription : IUtf8JsonSerializable
 16    {
 17        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 18        {
 819            writer.WriteStartObject();
 820            writer.WritePropertyName("location");
 821            writer.WriteStringValue(Location);
 822            if (Optional.IsCollectionDefined(Tags))
 23            {
 024                if (Tags != null)
 25                {
 026                    writer.WritePropertyName("tags");
 027                    writer.WriteStartObject();
 028                    foreach (var item in Tags)
 29                    {
 030                        writer.WritePropertyName(item.Key);
 031                        writer.WriteStringValue(item.Value);
 32                    }
 033                    writer.WriteEndObject();
 34                }
 35                else
 36                {
 037                    writer.WriteNull("tags");
 38                }
 39            }
 840            if (Optional.IsDefined(Sku))
 41            {
 042                writer.WritePropertyName("sku");
 043                writer.WriteObjectValue(Sku);
 44            }
 845            writer.WritePropertyName("properties");
 846            writer.WriteStartObject();
 847            writer.WriteEndObject();
 848            writer.WriteEndObject();
 849        }
 50
 51        internal static DigitalTwinsDescription DeserializeDigitalTwinsDescription(JsonElement element)
 52        {
 4253            Optional<string> id = default;
 4254            Optional<string> name = default;
 4255            Optional<string> type = default;
 4256            string location = default;
 4257            Optional<IDictionary<string, string>> tags = default;
 4258            Optional<DigitalTwinsSkuInfo> sku = default;
 4259            Optional<DateTimeOffset> createdTime = default;
 4260            Optional<DateTimeOffset> lastUpdatedTime = default;
 4261            Optional<ProvisioningState> provisioningState = default;
 4262            Optional<string> hostName = default;
 58863            foreach (var property in element.EnumerateObject())
 64            {
 25265                if (property.NameEquals("id"))
 66                {
 4267                    id = property.Value.GetString();
 4268                    continue;
 69                }
 21070                if (property.NameEquals("name"))
 71                {
 4272                    name = property.Value.GetString();
 4273                    continue;
 74                }
 16875                if (property.NameEquals("type"))
 76                {
 4277                    type = property.Value.GetString();
 4278                    continue;
 79                }
 12680                if (property.NameEquals("location"))
 81                {
 4282                    location = property.Value.GetString();
 4283                    continue;
 84                }
 8485                if (property.NameEquals("tags"))
 86                {
 4287                    if (property.Value.ValueKind == JsonValueKind.Null)
 88                    {
 4289                        tags = null;
 4290                        continue;
 91                    }
 092                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 093                    foreach (var property0 in property.Value.EnumerateObject())
 94                    {
 095                        dictionary.Add(property0.Name, property0.Value.GetString());
 96                    }
 097                    tags = dictionary;
 098                    continue;
 99                }
 42100                if (property.NameEquals("sku"))
 101                {
 0102                    sku = DigitalTwinsSkuInfo.DeserializeDigitalTwinsSkuInfo(property.Value);
 0103                    continue;
 104                }
 42105                if (property.NameEquals("properties"))
 106                {
 420107                    foreach (var property0 in property.Value.EnumerateObject())
 108                    {
 168109                        if (property0.NameEquals("createdTime"))
 110                        {
 42111                            createdTime = property0.Value.GetDateTimeOffset("O");
 42112                            continue;
 113                        }
 126114                        if (property0.NameEquals("lastUpdatedTime"))
 115                        {
 42116                            lastUpdatedTime = property0.Value.GetDateTimeOffset("O");
 42117                            continue;
 118                        }
 84119                        if (property0.NameEquals("provisioningState"))
 120                        {
 42121                            provisioningState = new ProvisioningState(property0.Value.GetString());
 42122                            continue;
 123                        }
 42124                        if (property0.NameEquals("hostName"))
 125                        {
 42126                            hostName = property0.Value.GetString();
 127                            continue;
 128                        }
 129                    }
 130                    continue;
 131                }
 132            }
 42133            return new DigitalTwinsDescription(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), 
 134        }
 135    }
 136}