< Summary

Class:Azure.Search.Documents.Indexes.Models.SearchResourceCounter
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchResourceCounter.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchResourceCounter.Serialization.cs
Covered lines:18
Uncovered lines:3
Coverable lines:21
Total lines:74
Line coverage:85.7% (18 of 21)
Covered branches:8
Total branches:8
Branch coverage:100% (8 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%100%
.ctor(...)-100%100%
get_Usage()-100%100%
get_Quota()-100%100%
DeserializeSearchResourceCounter(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchResourceCounter.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
 8namespace Azure.Search.Documents.Indexes.Models
 9{
 10    /// <summary> Represents a resource&apos;s usage and quota. </summary>
 11    public partial class SearchResourceCounter
 12    {
 13        /// <summary> Initializes a new instance of SearchResourceCounter. </summary>
 14        /// <param name="usage"> The resource usage amount. </param>
 015        internal SearchResourceCounter(long usage)
 16        {
 017            Usage = usage;
 018        }
 19
 20        /// <summary> Initializes a new instance of SearchResourceCounter. </summary>
 21        /// <param name="usage"> The resource usage amount. </param>
 22        /// <param name="quota"> The resource amount quota. </param>
 3623        internal SearchResourceCounter(long usage, long? quota)
 24        {
 3625            Usage = usage;
 3626            Quota = quota;
 3627        }
 28
 29        /// <summary> The resource usage amount. </summary>
 830        public long Usage { get; }
 31        /// <summary> The resource amount quota. </summary>
 432        public long? Quota { get; }
 33    }
 34}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchResourceCounter.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.Text.Json;
 9using Azure.Core;
 10
 11namespace Azure.Search.Documents.Indexes.Models
 12{
 13    public partial class SearchResourceCounter
 14    {
 15        internal static SearchResourceCounter DeserializeSearchResourceCounter(JsonElement element)
 16        {
 3617            long usage = default;
 3618            Optional<long?> quota = default;
 21619            foreach (var property in element.EnumerateObject())
 20            {
 7221                if (property.NameEquals("usage"))
 22                {
 3623                    usage = property.Value.GetInt64();
 3624                    continue;
 25                }
 3626                if (property.NameEquals("quota"))
 27                {
 3628                    if (property.Value.ValueKind == JsonValueKind.Null)
 29                    {
 630                        quota = null;
 631                        continue;
 32                    }
 3033                    quota = property.Value.GetInt64();
 34                    continue;
 35                }
 36            }
 3637            return new SearchResourceCounter(usage, Optional.ToNullable(quota));
 38        }
 39    }
 40}