< Summary

Class:Microsoft.Azure.CognitiveServices.Search.ImageSearch.Models.PivotSuggestions
Assembly:Microsoft.Azure.CognitiveServices.Search.BingImageSearch
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingImageSearch\src\Generated\ImageSearch\Models\PivotSuggestions.cs
Covered lines:3
Uncovered lines:14
Coverable lines:17
Total lines:87
Line coverage:17.6% (3 of 17)
Covered branches:0
Total branches:10
Branch coverage:0% (0 of 10)

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingImageSearch\src\Generated\ImageSearch\Models\PivotSuggestions.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.ImageSearch.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    /// Defines the pivot segment.
 17    /// </summary>
 18    public partial class PivotSuggestions
 19    {
 20        /// <summary>
 21        /// Initializes a new instance of the PivotSuggestions class.
 22        /// </summary>
 223        public PivotSuggestions()
 24        {
 25            CustomInit();
 226        }
 27
 28        /// <summary>
 29        /// Initializes a new instance of the PivotSuggestions class.
 30        /// </summary>
 31        /// <param name="pivot">The segment from the original query to pivot
 32        /// on.</param>
 33        /// <param name="suggestions">A list of suggested queries for the
 34        /// pivot.</param>
 035        public PivotSuggestions(string pivot, IList<Query> suggestions)
 36        {
 037            Pivot = pivot;
 038            Suggestions = suggestions;
 39            CustomInit();
 040        }
 41
 42        /// <summary>
 43        /// An initialization method that performs custom operations like setting defaults
 44        /// </summary>
 45        partial void CustomInit();
 46
 47        /// <summary>
 48        /// Gets or sets the segment from the original query to pivot on.
 49        /// </summary>
 50        [JsonProperty(PropertyName = "pivot")]
 051        public string Pivot { get; set; }
 52
 53        /// <summary>
 54        /// Gets or sets a list of suggested queries for the pivot.
 55        /// </summary>
 56        [JsonProperty(PropertyName = "suggestions")]
 457        public IList<Query> Suggestions { get; set; }
 58
 59        /// <summary>
 60        /// Validate the object.
 61        /// </summary>
 62        /// <exception cref="ValidationException">
 63        /// Thrown if validation fails
 64        /// </exception>
 65        public virtual void Validate()
 66        {
 067            if (Pivot == null)
 68            {
 069                throw new ValidationException(ValidationRules.CannotBeNull, "Pivot");
 70            }
 071            if (Suggestions == null)
 72            {
 073                throw new ValidationException(ValidationRules.CannotBeNull, "Suggestions");
 74            }
 075            if (Suggestions != null)
 76            {
 077                foreach (var element in Suggestions)
 78                {
 079                    if (element != null)
 80                    {
 081                        element.Validate();
 82                    }
 83                }
 84            }
 085        }
 86    }
 87}