< Summary

Class:Microsoft.Azure.CognitiveServices.Search.AutoSuggest.Models.QueryContext
Assembly:Microsoft.Azure.CognitiveServices.Search.BingAutoSuggest
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingAutoSuggest\src\Generated\AutoSuggest\Models\QueryContext.cs
Covered lines:2
Uncovered lines:17
Coverable lines:19
Total lines:143
Line coverage:10.5% (2 of 19)
Covered branches:0
Total branches:2
Branch coverage:0% (0 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-0%100%
get_OriginalQuery()-0%100%
get_AlteredQuery()-0%100%
get_AlterationOverrideQuery()-0%100%
get_AdultIntent()-0%100%
get_AskUserForLocation()-0%100%
get_IsTransactional()-0%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingAutoSuggest\src\Generated\AutoSuggest\Models\QueryContext.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.AutoSuggest.Models
 8{
 9    using Microsoft.Rest;
 10    using Newtonsoft.Json;
 11    using System.Linq;
 12
 13    /// <summary>
 14    /// Defines the query context that Bing used for the request.
 15    /// </summary>
 16    public partial class QueryContext
 17    {
 18        /// <summary>
 19        /// Initializes a new instance of the QueryContext class.
 20        /// </summary>
 221        public QueryContext()
 22        {
 23            CustomInit();
 224        }
 25
 26        /// <summary>
 27        /// Initializes a new instance of the QueryContext class.
 28        /// </summary>
 29        /// <param name="originalQuery">The query string as specified in the
 30        /// request.</param>
 31        /// <param name="alteredQuery">The query string used by Bing to perform
 32        /// the query. Bing uses the altered query string if the original query
 33        /// string contained spelling mistakes. For example, if the query
 34        /// string is "saling downwind", the altered query string will be
 35        /// "sailing downwind". This field is included only if the original
 36        /// query string contains a spelling mistake.</param>
 37        /// <param name="alterationOverrideQuery">The query string to use to
 38        /// force Bing to use the original string. For example, if the query
 39        /// string is "saling downwind", the override query string will be
 40        /// "+saling downwind". Remember to encode the query string which
 41        /// results in "%2Bsaling+downwind". This field is included only if the
 42        /// original query string contains a spelling mistake.</param>
 43        /// <param name="adultIntent">A Boolean value that indicates whether
 44        /// the specified query has adult intent. The value is true if the
 45        /// query has adult intent; otherwise, false.</param>
 46        /// <param name="askUserForLocation">A Boolean value that indicates
 47        /// whether Bing requires the user's location to provide accurate
 48        /// results. If you specified the user's location by using the
 49        /// X-MSEdge-ClientIP and X-Search-Location headers, you can ignore
 50        /// this field. For location aware queries, such as "today's weather"
 51        /// or "restaurants near me" that need the user's location to provide
 52        /// accurate results, this field is set to true. For location aware
 53        /// queries that include the location (for example, "Seattle weather"),
 54        /// this field is set to false. This field is also set to false for
 55        /// queries that are not location aware, such as "best
 56        /// sellers".</param>
 057        public QueryContext(string originalQuery, string alteredQuery = default(string), string alterationOverrideQuery 
 58        {
 059            OriginalQuery = originalQuery;
 060            AlteredQuery = alteredQuery;
 061            AlterationOverrideQuery = alterationOverrideQuery;
 062            AdultIntent = adultIntent;
 063            AskUserForLocation = askUserForLocation;
 064            IsTransactional = isTransactional;
 65            CustomInit();
 066        }
 67
 68        /// <summary>
 69        /// An initialization method that performs custom operations like setting defaults
 70        /// </summary>
 71        partial void CustomInit();
 72
 73        /// <summary>
 74        /// Gets or sets the query string as specified in the request.
 75        /// </summary>
 76        [JsonProperty(PropertyName = "originalQuery")]
 077        public string OriginalQuery { get; set; }
 78
 79        /// <summary>
 80        /// Gets the query string used by Bing to perform the query. Bing uses
 81        /// the altered query string if the original query string contained
 82        /// spelling mistakes. For example, if the query string is "saling
 83        /// downwind", the altered query string will be "sailing downwind".
 84        /// This field is included only if the original query string contains a
 85        /// spelling mistake.
 86        /// </summary>
 87        [JsonProperty(PropertyName = "alteredQuery")]
 088        public string AlteredQuery { get; private set; }
 89
 90        /// <summary>
 91        /// Gets the query string to use to force Bing to use the original
 92        /// string. For example, if the query string is "saling downwind", the
 93        /// override query string will be "+saling downwind". Remember to
 94        /// encode the query string which results in "%2Bsaling+downwind". This
 95        /// field is included only if the original query string contains a
 96        /// spelling mistake.
 97        /// </summary>
 98        [JsonProperty(PropertyName = "alterationOverrideQuery")]
 099        public string AlterationOverrideQuery { get; private set; }
 100
 101        /// <summary>
 102        /// Gets a Boolean value that indicates whether the specified query has
 103        /// adult intent. The value is true if the query has adult intent;
 104        /// otherwise, false.
 105        /// </summary>
 106        [JsonProperty(PropertyName = "adultIntent")]
 0107        public bool? AdultIntent { get; private set; }
 108
 109        /// <summary>
 110        /// Gets a Boolean value that indicates whether Bing requires the
 111        /// user's location to provide accurate results. If you specified the
 112        /// user's location by using the X-MSEdge-ClientIP and
 113        /// X-Search-Location headers, you can ignore this field. For location
 114        /// aware queries, such as "today's weather" or "restaurants near me"
 115        /// that need the user's location to provide accurate results, this
 116        /// field is set to true. For location aware queries that include the
 117        /// location (for example, "Seattle weather"), this field is set to
 118        /// false. This field is also set to false for queries that are not
 119        /// location aware, such as "best sellers".
 120        /// </summary>
 121        [JsonProperty(PropertyName = "askUserForLocation")]
 0122        public bool? AskUserForLocation { get; private set; }
 123
 124        /// <summary>
 125        /// </summary>
 126        [JsonProperty(PropertyName = "isTransactional")]
 0127        public bool? IsTransactional { get; private set; }
 128
 129        /// <summary>
 130        /// Validate the object.
 131        /// </summary>
 132        /// <exception cref="ValidationException">
 133        /// Thrown if validation fails
 134        /// </exception>
 135        public virtual void Validate()
 136        {
 0137            if (OriginalQuery == null)
 138            {
 0139                throw new ValidationException(ValidationRules.CannotBeNull, "OriginalQuery");
 140            }
 0141        }
 142    }
 143}