< Summary

Class:Azure.ResourceManager.EventHubs.Models.Eventhub
Assembly:Azure.ResourceManager.EventHubs
File(s):C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\Models\Eventhub.cs
C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\src\Generated\Models\Eventhub.Serialization.cs
Covered lines:114
Uncovered lines:1
Coverable lines:115
Total lines:266
Line coverage:99.1% (114 of 115)
Covered branches:71
Total branches:72
Branch coverage:98.6% (71 of 72)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_PartitionIds()-100%100%
get_CreatedAt()-100%100%
get_UpdatedAt()-100%100%
get_MessageRetentionInDays()-100%100%
get_PartitionCount()-100%100%
get_Status()-100%100%
get_CaptureDescription()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeEventhub(...)-98.28%98%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\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.EventHubs.Models
 12{
 13    /// <summary> Single item in List or Get Event Hub operation. </summary>
 14    public partial class Eventhub : Resource
 15    {
 16        /// <summary> Initializes a new instance of Eventhub. </summary>
 6017        public Eventhub()
 18        {
 6019        }
 20
 21        /// <summary> Initializes a new instance of Eventhub. </summary>
 22        /// <param name="id"> Resource ID. </param>
 23        /// <param name="name"> Resource name. </param>
 24        /// <param name="type"> Resource type. </param>
 25        /// <param name="partitionIds"> Current number of shards on the Event Hub. </param>
 26        /// <param name="createdAt"> Exact time the Event Hub was created. </param>
 27        /// <param name="updatedAt"> The exact time the message was updated. </param>
 28        /// <param name="messageRetentionInDays"> Number of days to retain the events for this Event Hub, value should b
 29        /// <param name="partitionCount"> Number of partitions created for the Event Hub, allowed values are from 1 to 3
 30        /// <param name="status"> Enumerates the possible values for the status of the Event Hub. </param>
 31        /// <param name="captureDescription"> Properties of capture description. </param>
 15232        internal Eventhub(string id, string name, string type, IList<string> partitionIds, DateTimeOffset? createdAt, Da
 33        {
 15234            PartitionIds = partitionIds;
 15235            CreatedAt = createdAt;
 15236            UpdatedAt = updatedAt;
 15237            MessageRetentionInDays = messageRetentionInDays;
 15238            PartitionCount = partitionCount;
 15239            Status = status;
 15240            CaptureDescription = captureDescription;
 15241        }
 42
 43        /// <summary> Current number of shards on the Event Hub. </summary>
 6844        public IList<string> PartitionIds { get; }
 45        /// <summary> Exact time the Event Hub was created. </summary>
 6846        public DateTimeOffset? CreatedAt { get; }
 47        /// <summary> The exact time the message was updated. </summary>
 6848        public DateTimeOffset? UpdatedAt { get; }
 49        /// <summary> Number of days to retain the events for this Event Hub, value should be 1 to 7 days. </summary>
 26850        public long? MessageRetentionInDays { get; set; }
 51        /// <summary> Number of partitions created for the Event Hub, allowed values are from 1 to 32 partitions. </summ
 22852        public long? PartitionCount { get; set; }
 53        /// <summary> Enumerates the possible values for the status of the Event Hub. </summary>
 25254        public EntityStatus? Status { get; set; }
 55        /// <summary> Properties of capture description. </summary>
 24056        public CaptureDescription CaptureDescription { get; set; }
 57    }
 58}

C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.ResourceManager.EventHubs\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.EventHubs.Models
 14{
 15    public partial class Eventhub : IUtf8JsonSerializable
 16    {
 17        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 18        {
 6419            writer.WriteStartObject();
 6420            if (Id != null)
 21            {
 422                writer.WritePropertyName("id");
 423                writer.WriteStringValue(Id);
 24            }
 6425            if (Name != null)
 26            {
 427                writer.WritePropertyName("name");
 428                writer.WriteStringValue(Name);
 29            }
 6430            if (Type != null)
 31            {
 432                writer.WritePropertyName("type");
 433                writer.WriteStringValue(Type);
 34            }
 6435            writer.WritePropertyName("properties");
 6436            writer.WriteStartObject();
 6437            if (PartitionIds != null)
 38            {
 439                writer.WritePropertyName("partitionIds");
 440                writer.WriteStartArray();
 4041                foreach (var item in PartitionIds)
 42                {
 1643                    writer.WriteStringValue(item);
 44                }
 445                writer.WriteEndArray();
 46            }
 6447            if (CreatedAt != null)
 48            {
 449                writer.WritePropertyName("createdAt");
 450                writer.WriteStringValue(CreatedAt.Value, "O");
 51            }
 6452            if (UpdatedAt != null)
 53            {
 454                writer.WritePropertyName("updatedAt");
 455                writer.WriteStringValue(UpdatedAt.Value, "O");
 56            }
 6457            if (MessageRetentionInDays != null)
 58            {
 2459                writer.WritePropertyName("messageRetentionInDays");
 2460                writer.WriteNumberValue(MessageRetentionInDays.Value);
 61            }
 6462            if (PartitionCount != null)
 63            {
 864                writer.WritePropertyName("partitionCount");
 865                writer.WriteNumberValue(PartitionCount.Value);
 66            }
 6467            if (Status != null)
 68            {
 869                writer.WritePropertyName("status");
 870                writer.WriteStringValue(Status.Value.ToSerialString());
 71            }
 6472            if (CaptureDescription != null)
 73            {
 874                writer.WritePropertyName("captureDescription");
 875                writer.WriteObjectValue(CaptureDescription);
 76            }
 6477            writer.WriteEndObject();
 6478            writer.WriteEndObject();
 6479        }
 80
 81        internal static Eventhub DeserializeEventhub(JsonElement element)
 82        {
 15283            string id = default;
 15284            string name = default;
 15285            string type = default;
 15286            IList<string> partitionIds = default;
 15287            DateTimeOffset? createdAt = default;
 15288            DateTimeOffset? updatedAt = default;
 15289            long? messageRetentionInDays = default;
 15290            long? partitionCount = default;
 15291            EntityStatus? status = default;
 15292            CaptureDescription captureDescription = default;
 182493            foreach (var property in element.EnumerateObject())
 94            {
 76095                if (property.NameEquals("id"))
 96                {
 15297                    if (property.Value.ValueKind == JsonValueKind.Null)
 98                    {
 99                        continue;
 100                    }
 152101                    id = property.Value.GetString();
 152102                    continue;
 103                }
 608104                if (property.NameEquals("name"))
 105                {
 152106                    if (property.Value.ValueKind == JsonValueKind.Null)
 107                    {
 108                        continue;
 109                    }
 152110                    name = property.Value.GetString();
 152111                    continue;
 112                }
 456113                if (property.NameEquals("type"))
 114                {
 152115                    if (property.Value.ValueKind == JsonValueKind.Null)
 116                    {
 117                        continue;
 118                    }
 152119                    type = property.Value.GetString();
 152120                    continue;
 121                }
 304122                if (property.NameEquals("properties"))
 123                {
 2168124                    foreach (var property0 in property.Value.EnumerateObject())
 125                    {
 932126                        if (property0.NameEquals("partitionIds"))
 127                        {
 152128                            if (property0.Value.ValueKind == JsonValueKind.Null)
 129                            {
 130                                continue;
 131                            }
 152132                            List<string> array = new List<string>();
 1488133                            foreach (var item in property0.Value.EnumerateArray())
 134                            {
 592135                                if (item.ValueKind == JsonValueKind.Null)
 136                                {
 0137                                    array.Add(null);
 138                                }
 139                                else
 140                                {
 592141                                    array.Add(item.GetString());
 142                                }
 143                            }
 152144                            partitionIds = array;
 152145                            continue;
 146                        }
 780147                        if (property0.NameEquals("createdAt"))
 148                        {
 152149                            if (property0.Value.ValueKind == JsonValueKind.Null)
 150                            {
 151                                continue;
 152                            }
 152153                            createdAt = property0.Value.GetDateTimeOffset("O");
 152154                            continue;
 155                        }
 628156                        if (property0.NameEquals("updatedAt"))
 157                        {
 152158                            if (property0.Value.ValueKind == JsonValueKind.Null)
 159                            {
 160                                continue;
 161                            }
 152162                            updatedAt = property0.Value.GetDateTimeOffset("O");
 152163                            continue;
 164                        }
 476165                        if (property0.NameEquals("messageRetentionInDays"))
 166                        {
 152167                            if (property0.Value.ValueKind == JsonValueKind.Null)
 168                            {
 169                                continue;
 170                            }
 152171                            messageRetentionInDays = property0.Value.GetInt64();
 152172                            continue;
 173                        }
 324174                        if (property0.NameEquals("partitionCount"))
 175                        {
 152176                            if (property0.Value.ValueKind == JsonValueKind.Null)
 177                            {
 178                                continue;
 179                            }
 152180                            partitionCount = property0.Value.GetInt64();
 152181                            continue;
 182                        }
 172183                        if (property0.NameEquals("status"))
 184                        {
 152185                            if (property0.Value.ValueKind == JsonValueKind.Null)
 186                            {
 187                                continue;
 188                            }
 152189                            status = property0.Value.GetString().ToEntityStatus();
 152190                            continue;
 191                        }
 20192                        if (property0.NameEquals("captureDescription"))
 193                        {
 20194                            if (property0.Value.ValueKind == JsonValueKind.Null)
 195                            {
 196                                continue;
 197                            }
 20198                            captureDescription = CaptureDescription.DeserializeCaptureDescription(property0.Value);
 199                            continue;
 200                        }
 201                    }
 202                    continue;
 203                }
 204            }
 152205            return new Eventhub(id, name, type, partitionIds, createdAt, updatedAt, messageRetentionInDays, partitionCou
 206        }
 207    }
 208}