< Summary

Class:Microsoft.Azure.CognitiveServices.Search.NewsSearch.Models.ErrorResponse
Assembly:Microsoft.Azure.CognitiveServices.Search.BingNewsSearch
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingNewsSearch\src\Generated\NewsSearch\Models\ErrorResponse.cs
Covered lines:0
Uncovered lines:13
Coverable lines:13
Total lines:79
Line coverage:0% (0 of 13)
Covered branches:0
Total branches:8
Branch coverage:0% (0 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
get_Errors()-0%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingNewsSearch\src\Generated\NewsSearch\Models\ErrorResponse.cs

#LineLine coverage
 1// <auto-generated>
 2// Code generated by Microsoft (R) AutoRest Code Generator.
 3// Changes may cause incorrect behavior and will be lost if the code is
 4// regenerated.
 5// </auto-generated>
 6
 7namespace Microsoft.Azure.CognitiveServices.Search.NewsSearch.Models
 8{
 9    using Microsoft.Rest;
 10    using Newtonsoft.Json;
 11    using System.Collections;
 12    using System.Collections.Generic;
 13    using System.Linq;
 14
 15    /// <summary>
 16    /// The top-level response that represents a failed request.
 17    /// </summary>
 18    public partial class ErrorResponse : Response
 19    {
 20        /// <summary>
 21        /// Initializes a new instance of the ErrorResponse class.
 22        /// </summary>
 023        public ErrorResponse()
 24        {
 25            CustomInit();
 026        }
 27
 28        /// <summary>
 29        /// Initializes a new instance of the ErrorResponse class.
 30        /// </summary>
 31        /// <param name="errors">A list of errors that describe the reasons why
 32        /// the request failed.</param>
 33        /// <param name="id">A String identifier.</param>
 34        /// <param name="webSearchUrl">The URL To Bing's search result for this
 35        /// item.</param>
 36        public ErrorResponse(IList<Error> errors, string id = default(string), string webSearchUrl = default(string))
 037            : base(id, webSearchUrl)
 38        {
 039            Errors = errors;
 40            CustomInit();
 041        }
 42
 43        /// <summary>
 44        /// An initialization method that performs custom operations like setting defaults
 45        /// </summary>
 46        partial void CustomInit();
 47
 48        /// <summary>
 49        /// Gets or sets a list of errors that describe the reasons why the
 50        /// request failed.
 51        /// </summary>
 52        [JsonProperty(PropertyName = "errors")]
 053        public IList<Error> Errors { get; set; }
 54
 55        /// <summary>
 56        /// Validate the object.
 57        /// </summary>
 58        /// <exception cref="ValidationException">
 59        /// Thrown if validation fails
 60        /// </exception>
 61        public virtual void Validate()
 62        {
 063            if (Errors == null)
 64            {
 065                throw new ValidationException(ValidationRules.CannotBeNull, "Errors");
 66            }
 067            if (Errors != null)
 68            {
 069                foreach (var element in Errors)
 70                {
 071                    if (element != null)
 72                    {
 073                        element.Validate();
 74                    }
 75                }
 76            }
 077        }
 78    }
 79}