< Summary

Class:Azure.ResourceManager.Resources.Models.ErrorResponse
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ErrorResponse.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ErrorResponse.Serialization.cs
Covered lines:22
Uncovered lines:52
Coverable lines:74
Total lines:185
Line coverage:29.7% (22 of 74)
Covered branches:13
Total branches:44
Branch coverage:29.5% (13 of 44)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_Code()-0%100%
get_Message()-0%100%
get_Target()-0%100%
get_Details()-0%100%
get_AdditionalInfo()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeErrorResponse(...)-41.67%43.33%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ErrorResponse.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.Collections.Generic;
 9
 10namespace Azure.ResourceManager.Resources.Models
 11{
 12    /// <summary> The resource management error response. </summary>
 13    public partial class ErrorResponse
 14    {
 15        /// <summary> Initializes a new instance of ErrorResponse. </summary>
 016        public ErrorResponse()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of ErrorResponse. </summary>
 21        /// <param name="code"> The error code. </param>
 22        /// <param name="message"> The error message. </param>
 23        /// <param name="target"> The error target. </param>
 24        /// <param name="details"> The error details. </param>
 25        /// <param name="additionalInfo"> The error additional info. </param>
 1626        internal ErrorResponse(string code, string message, string target, IList<ErrorResponse> details, IList<ErrorAddi
 27        {
 1628            Code = code;
 1629            Message = message;
 1630            Target = target;
 1631            Details = details;
 1632            AdditionalInfo = additionalInfo;
 1633        }
 34
 35        /// <summary> The error code. </summary>
 036        public string Code { get; }
 37        /// <summary> The error message. </summary>
 038        public string Message { get; }
 39        /// <summary> The error target. </summary>
 040        public string Target { get; }
 41        /// <summary> The error details. </summary>
 042        public IList<ErrorResponse> Details { get; }
 43        /// <summary> The error additional info. </summary>
 044        public IList<ErrorAdditionalInfo> AdditionalInfo { get; }
 45    }
 46}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ErrorResponse.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.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.Resources.Models
 13{
 14    public partial class ErrorResponse : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Code != null)
 20            {
 021                writer.WritePropertyName("code");
 022                writer.WriteStringValue(Code);
 23            }
 024            if (Message != null)
 25            {
 026                writer.WritePropertyName("message");
 027                writer.WriteStringValue(Message);
 28            }
 029            if (Target != null)
 30            {
 031                writer.WritePropertyName("target");
 032                writer.WriteStringValue(Target);
 33            }
 034            if (Details != null)
 35            {
 036                writer.WritePropertyName("details");
 037                writer.WriteStartArray();
 038                foreach (var item in Details)
 39                {
 040                    writer.WriteObjectValue(item);
 41                }
 042                writer.WriteEndArray();
 43            }
 044            if (AdditionalInfo != null)
 45            {
 046                writer.WritePropertyName("additionalInfo");
 047                writer.WriteStartArray();
 048                foreach (var item in AdditionalInfo)
 49                {
 050                    writer.WriteObjectValue(item);
 51                }
 052                writer.WriteEndArray();
 53            }
 054            writer.WriteEndObject();
 055        }
 56
 57        internal static ErrorResponse DeserializeErrorResponse(JsonElement element)
 58        {
 1659            string code = default;
 1660            string message = default;
 1661            string target = default;
 1662            IList<ErrorResponse> details = default;
 1663            IList<ErrorAdditionalInfo> additionalInfo = default;
 9664            foreach (var property in element.EnumerateObject())
 65            {
 3266                if (property.NameEquals("code"))
 67                {
 1668                    if (property.Value.ValueKind == JsonValueKind.Null)
 69                    {
 70                        continue;
 71                    }
 1672                    code = property.Value.GetString();
 1673                    continue;
 74                }
 1675                if (property.NameEquals("message"))
 76                {
 1677                    if (property.Value.ValueKind == JsonValueKind.Null)
 78                    {
 79                        continue;
 80                    }
 1681                    message = property.Value.GetString();
 1682                    continue;
 83                }
 084                if (property.NameEquals("target"))
 85                {
 086                    if (property.Value.ValueKind == JsonValueKind.Null)
 87                    {
 88                        continue;
 89                    }
 090                    target = property.Value.GetString();
 091                    continue;
 92                }
 093                if (property.NameEquals("details"))
 94                {
 095                    if (property.Value.ValueKind == JsonValueKind.Null)
 96                    {
 97                        continue;
 98                    }
 099                    List<ErrorResponse> array = new List<ErrorResponse>();
 0100                    foreach (var item in property.Value.EnumerateArray())
 101                    {
 0102                        if (item.ValueKind == JsonValueKind.Null)
 103                        {
 0104                            array.Add(null);
 105                        }
 106                        else
 107                        {
 0108                            array.Add(DeserializeErrorResponse(item));
 109                        }
 110                    }
 0111                    details = array;
 0112                    continue;
 113                }
 0114                if (property.NameEquals("additionalInfo"))
 115                {
 0116                    if (property.Value.ValueKind == JsonValueKind.Null)
 117                    {
 118                        continue;
 119                    }
 0120                    List<ErrorAdditionalInfo> array = new List<ErrorAdditionalInfo>();
 0121                    foreach (var item in property.Value.EnumerateArray())
 122                    {
 0123                        if (item.ValueKind == JsonValueKind.Null)
 124                        {
 0125                            array.Add(null);
 126                        }
 127                        else
 128                        {
 0129                            array.Add(ErrorAdditionalInfo.DeserializeErrorAdditionalInfo(item));
 130                        }
 131                    }
 0132                    additionalInfo = array;
 133                    continue;
 134                }
 135            }
 16136            return new ErrorResponse(code, message, target, details, additionalInfo);
 137        }
 138    }
 139}