< Summary

Class:Azure.ResourceManager.DigitalTwins.Models.ServiceBus
Assembly:Azure.ResourceManager.DigitalTwins
File(s):C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\ServiceBus.cs
C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\ServiceBus.Serialization.cs
Covered lines:0
Uncovered lines:60
Coverable lines:60
Total lines:144
Line coverage:0% (0 of 60)
Covered branches:0
Total branches:24
Branch coverage:0% (0 of 24)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%100%
get_PrimaryConnectionString()-0%100%
get_SecondaryConnectionString()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeServiceBus(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\ServiceBus.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> properties related to servicebus. </summary>
 14    public partial class ServiceBus : DigitalTwinsEndpointResourceProperties
 15    {
 16        /// <summary> Initializes a new instance of ServiceBus. </summary>
 17        /// <param name="primaryConnectionString"> PrimaryConnectionString of the endpoint. Will be obfuscated during re
 18        /// <param name="secondaryConnectionString"> SecondaryConnectionString of the endpoint. Will be obfuscated durin
 19        /// <exception cref="ArgumentNullException"> <paramref name="primaryConnectionString"/> or <paramref name="secon
 020        public ServiceBus(string primaryConnectionString, string secondaryConnectionString)
 21        {
 022            if (primaryConnectionString == null)
 23            {
 024                throw new ArgumentNullException(nameof(primaryConnectionString));
 25            }
 026            if (secondaryConnectionString == null)
 27            {
 028                throw new ArgumentNullException(nameof(secondaryConnectionString));
 29            }
 30
 031            PrimaryConnectionString = primaryConnectionString;
 032            SecondaryConnectionString = secondaryConnectionString;
 033            EndpointType = EndpointType.ServiceBus;
 034        }
 35
 36        /// <summary> Initializes a new instance of ServiceBus. </summary>
 37        /// <param name="endpointType"> The type of Digital Twins endpoint. </param>
 38        /// <param name="provisioningState"> The provisioning state. </param>
 39        /// <param name="createdTime"> Time when the Endpoint was added to DigitalTwinsInstance. </param>
 40        /// <param name="tags"> The resource tags. </param>
 41        /// <param name="primaryConnectionString"> PrimaryConnectionString of the endpoint. Will be obfuscated during re
 42        /// <param name="secondaryConnectionString"> SecondaryConnectionString of the endpoint. Will be obfuscated durin
 043        internal ServiceBus(EndpointType endpointType, EndpointProvisioningState? provisioningState, DateTimeOffset? cre
 44        {
 045            PrimaryConnectionString = primaryConnectionString;
 046            SecondaryConnectionString = secondaryConnectionString;
 047            EndpointType = endpointType;
 048        }
 49
 50        /// <summary> PrimaryConnectionString of the endpoint. Will be obfuscated during read. </summary>
 051        public string PrimaryConnectionString { get; set; }
 52        /// <summary> SecondaryConnectionString of the endpoint. Will be obfuscated during read. </summary>
 053        public string SecondaryConnectionString { get; set; }
 54    }
 55}

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\ServiceBus.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 ServiceBus : IUtf8JsonSerializable
 16    {
 17        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 18        {
 019            writer.WriteStartObject();
 020            writer.WritePropertyName("primaryConnectionString");
 021            writer.WriteStringValue(PrimaryConnectionString);
 022            writer.WritePropertyName("secondaryConnectionString");
 023            writer.WriteStringValue(SecondaryConnectionString);
 024            writer.WritePropertyName("endpointType");
 025            writer.WriteStringValue(EndpointType.ToString());
 026            if (Optional.IsCollectionDefined(Tags))
 27            {
 028                writer.WritePropertyName("tags");
 029                writer.WriteStartObject();
 030                foreach (var item in Tags)
 31                {
 032                    writer.WritePropertyName(item.Key);
 033                    writer.WriteStringValue(item.Value);
 34                }
 035                writer.WriteEndObject();
 36            }
 037            writer.WriteEndObject();
 038        }
 39
 40        internal static ServiceBus DeserializeServiceBus(JsonElement element)
 41        {
 042            string primaryConnectionString = default;
 043            string secondaryConnectionString = default;
 044            EndpointType endpointType = default;
 045            Optional<EndpointProvisioningState> provisioningState = default;
 046            Optional<DateTimeOffset> createdTime = default;
 047            Optional<IDictionary<string, string>> tags = default;
 048            foreach (var property in element.EnumerateObject())
 49            {
 050                if (property.NameEquals("primaryConnectionString"))
 51                {
 052                    primaryConnectionString = property.Value.GetString();
 053                    continue;
 54                }
 055                if (property.NameEquals("secondaryConnectionString"))
 56                {
 057                    secondaryConnectionString = property.Value.GetString();
 058                    continue;
 59                }
 060                if (property.NameEquals("endpointType"))
 61                {
 062                    endpointType = new EndpointType(property.Value.GetString());
 063                    continue;
 64                }
 065                if (property.NameEquals("provisioningState"))
 66                {
 067                    provisioningState = new EndpointProvisioningState(property.Value.GetString());
 068                    continue;
 69                }
 070                if (property.NameEquals("createdTime"))
 71                {
 072                    createdTime = property.Value.GetDateTimeOffset("O");
 073                    continue;
 74                }
 075                if (property.NameEquals("tags"))
 76                {
 077                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 078                    foreach (var property0 in property.Value.EnumerateObject())
 79                    {
 080                        dictionary.Add(property0.Name, property0.Value.GetString());
 81                    }
 082                    tags = dictionary;
 83                    continue;
 84                }
 85            }
 086            return new ServiceBus(endpointType, Optional.ToNullable(provisioningState), Optional.ToNullable(createdTime)
 87        }
 88    }
 89}