< Summary

Class:Azure.ResourceManager.DigitalTwins.Models.CheckNameResult
Assembly:Azure.ResourceManager.DigitalTwins
File(s):C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\CheckNameResult.cs
C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\CheckNameResult.Serialization.cs
Covered lines:21
Uncovered lines:8
Coverable lines:29
Total lines:87
Line coverage:72.4% (21 of 29)
Covered branches:9
Total branches:10
Branch coverage:90% (9 of 10)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_NameAvailable()-0%100%
get_Name()-0%100%
get_Message()-0%100%
get_Reason()-0%100%
DeserializeCheckNameResult(...)-88.24%90%

File(s)

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\CheckNameResult.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.ResourceManager.DigitalTwins.Models
 9{
 10    /// <summary> The result returned from a check name availability request. </summary>
 11    public partial class CheckNameResult
 12    {
 13        /// <summary> Initializes a new instance of CheckNameResult. </summary>
 014        internal CheckNameResult()
 15        {
 016        }
 17
 18        /// <summary> Initializes a new instance of CheckNameResult. </summary>
 19        /// <param name="nameAvailable"> Specifies a Boolean value that indicates if the name is available. </param>
 20        /// <param name="name"> The name that was checked. </param>
 21        /// <param name="message"> Message indicating an unavailable name due to a conflict, or a description of the nam
 22        /// <param name="reason"> Message providing the reason why the given name is invalid. </param>
 423        internal CheckNameResult(bool? nameAvailable, string name, string message, Reason? reason)
 24        {
 425            NameAvailable = nameAvailable;
 426            Name = name;
 427            Message = message;
 428            Reason = reason;
 429        }
 30
 31        /// <summary> Specifies a Boolean value that indicates if the name is available. </summary>
 032        public bool? NameAvailable { get; }
 33        /// <summary> The name that was checked. </summary>
 034        public string Name { get; }
 35        /// <summary> Message indicating an unavailable name due to a conflict, or a description of the naming rules tha
 036        public string Message { get; }
 37        /// <summary> Message providing the reason why the given name is invalid. </summary>
 038        public Reason? Reason { get; }
 39    }
 40}

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\CheckNameResult.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.ResourceManager.DigitalTwins.Models
 12{
 13    public partial class CheckNameResult
 14    {
 15        internal static CheckNameResult DeserializeCheckNameResult(JsonElement element)
 16        {
 417            Optional<bool> nameAvailable = default;
 418            Optional<string> name = default;
 419            Optional<string> message = default;
 420            Optional<Reason> reason = default;
 3221            foreach (var property in element.EnumerateObject())
 22            {
 1223                if (property.NameEquals("nameAvailable"))
 24                {
 425                    nameAvailable = property.Value.GetBoolean();
 426                    continue;
 27                }
 828                if (property.NameEquals("name"))
 29                {
 030                    name = property.Value.GetString();
 031                    continue;
 32                }
 833                if (property.NameEquals("message"))
 34                {
 435                    message = property.Value.GetString();
 436                    continue;
 37                }
 438                if (property.NameEquals("reason"))
 39                {
 440                    reason = new Reason(property.Value.GetString());
 41                    continue;
 42                }
 43            }
 444            return new CheckNameResult(Optional.ToNullable(nameAvailable), name.Value, message.Value, Optional.ToNullabl
 45        }
 46    }
 47}