< Summary

Class:Azure.ResourceManager.DigitalTwins.Models.EventHub
Assembly:Azure.ResourceManager.DigitalTwins
File(s):C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\EventHub.cs
C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\EventHub.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_ConnectionStringPrimaryKey()-0%100%
get_ConnectionStringSecondaryKey()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeEventHub(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\EventHub.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 eventhub. </summary>
 14    public partial class EventHub : DigitalTwinsEndpointResourceProperties
 15    {
 16        /// <summary> Initializes a new instance of EventHub. </summary>
 17        /// <param name="connectionStringPrimaryKey"> PrimaryConnectionString of the endpoint. Will be obfuscated during
 18        /// <param name="connectionStringSecondaryKey"> SecondaryConnectionString of the endpoint. Will be obfuscated du
 19        /// <exception cref="ArgumentNullException"> <paramref name="connectionStringPrimaryKey"/> or <paramref name="co
 020        public EventHub(string connectionStringPrimaryKey, string connectionStringSecondaryKey)
 21        {
 022            if (connectionStringPrimaryKey == null)
 23            {
 024                throw new ArgumentNullException(nameof(connectionStringPrimaryKey));
 25            }
 026            if (connectionStringSecondaryKey == null)
 27            {
 028                throw new ArgumentNullException(nameof(connectionStringSecondaryKey));
 29            }
 30
 031            ConnectionStringPrimaryKey = connectionStringPrimaryKey;
 032            ConnectionStringSecondaryKey = connectionStringSecondaryKey;
 033            EndpointType = EndpointType.EventHub;
 034        }
 35
 36        /// <summary> Initializes a new instance of EventHub. </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="connectionStringPrimaryKey"> PrimaryConnectionString of the endpoint. Will be obfuscated during
 42        /// <param name="connectionStringSecondaryKey"> SecondaryConnectionString of the endpoint. Will be obfuscated du
 043        internal EventHub(EndpointType endpointType, EndpointProvisioningState? provisioningState, DateTimeOffset? creat
 44        {
 045            ConnectionStringPrimaryKey = connectionStringPrimaryKey;
 046            ConnectionStringSecondaryKey = connectionStringSecondaryKey;
 047            EndpointType = endpointType;
 048        }
 49
 50        /// <summary> PrimaryConnectionString of the endpoint. Will be obfuscated during read. </summary>
 051        public string ConnectionStringPrimaryKey { get; set; }
 52        /// <summary> SecondaryConnectionString of the endpoint. Will be obfuscated during read. </summary>
 053        public string ConnectionStringSecondaryKey { get; set; }
 54    }
 55}

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\EventHub.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 EventHub : IUtf8JsonSerializable
 16    {
 17        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 18        {
 019            writer.WriteStartObject();
 020            writer.WritePropertyName("connectionString-PrimaryKey");
 021            writer.WriteStringValue(ConnectionStringPrimaryKey);
 022            writer.WritePropertyName("connectionString-SecondaryKey");
 023            writer.WriteStringValue(ConnectionStringSecondaryKey);
 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 EventHub DeserializeEventHub(JsonElement element)
 41        {
 042            string connectionStringPrimaryKey = default;
 043            string connectionStringSecondaryKey = 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("connectionString-PrimaryKey"))
 51                {
 052                    connectionStringPrimaryKey = property.Value.GetString();
 053                    continue;
 54                }
 055                if (property.NameEquals("connectionString-SecondaryKey"))
 56                {
 057                    connectionStringSecondaryKey = 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 EventHub(endpointType, Optional.ToNullable(provisioningState), Optional.ToNullable(createdTime), 
 87        }
 88    }
 89}