< Summary

Class:Microsoft.Azure.CognitiveServices.Search.ImageSearch.Models.Query
Assembly:Microsoft.Azure.CognitiveServices.Search.BingImageSearch
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingImageSearch\src\Generated\ImageSearch\Models\Query.cs
Covered lines:6
Uncovered lines:11
Coverable lines:17
Total lines:114
Line coverage:35.2% (6 of 17)
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_Text()-100%100%
get_DisplayText()-0%100%
get_WebSearchUrl()-100%100%
get_SearchLink()-100%100%
get_Thumbnail()-100%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingImageSearch\src\Generated\ImageSearch\Models\Query.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.Linq;
 12
 13    /// <summary>
 14    /// Defines a search query.
 15    /// </summary>
 16    public partial class Query
 17    {
 18        /// <summary>
 19        /// Initializes a new instance of the Query class.
 20        /// </summary>
 38821        public Query()
 22        {
 23            CustomInit();
 38824        }
 25
 26        /// <summary>
 27        /// Initializes a new instance of the Query class.
 28        /// </summary>
 29        /// <param name="text">The query string. Use this string as the query
 30        /// term in a new search request.</param>
 31        /// <param name="displayText">The display version of the query term.
 32        /// This version of the query term may contain special characters that
 33        /// highlight the search term found in the query string. The string
 34        /// contains the highlighting characters only if the query enabled hit
 35        /// highlighting</param>
 36        /// <param name="webSearchUrl">The URL that takes the user to the Bing
 37        /// search results page for the query.Only related search results
 38        /// include this field.</param>
 39        /// <param name="searchLink">The URL that you use to get the results of
 40        /// the related search. Before using the URL, you must append query
 41        /// parameters as appropriate and include the Ocp-Apim-Subscription-Key
 42        /// header. Use this URL if you're displaying the results in your own
 43        /// user interface. Otherwise, use the webSearchUrl URL.</param>
 44        /// <param name="thumbnail">The URL to a thumbnail of a related
 45        /// image.</param>
 046        public Query(string text, string displayText = default(string), string webSearchUrl = default(string), string se
 47        {
 048            Text = text;
 049            DisplayText = displayText;
 050            WebSearchUrl = webSearchUrl;
 051            SearchLink = searchLink;
 052            Thumbnail = thumbnail;
 53            CustomInit();
 054        }
 55
 56        /// <summary>
 57        /// An initialization method that performs custom operations like setting defaults
 58        /// </summary>
 59        partial void CustomInit();
 60
 61        /// <summary>
 62        /// Gets or sets the query string. Use this string as the query term in
 63        /// a new search request.
 64        /// </summary>
 65        [JsonProperty(PropertyName = "text")]
 39266        public string Text { get; set; }
 67
 68        /// <summary>
 69        /// Gets the display version of the query term. This version of the
 70        /// query term may contain special characters that highlight the search
 71        /// term found in the query string. The string contains the
 72        /// highlighting characters only if the query enabled hit highlighting
 73        /// </summary>
 74        [JsonProperty(PropertyName = "displayText")]
 075        public string DisplayText { get; private set; }
 76
 77        /// <summary>
 78        /// Gets the URL that takes the user to the Bing search results page
 79        /// for the query.Only related search results include this field.
 80        /// </summary>
 81        [JsonProperty(PropertyName = "webSearchUrl")]
 39082        public string WebSearchUrl { get; private set; }
 83
 84        /// <summary>
 85        /// Gets the URL that you use to get the results of the related search.
 86        /// Before using the URL, you must append query parameters as
 87        /// appropriate and include the Ocp-Apim-Subscription-Key header. Use
 88        /// this URL if you're displaying the results in your own user
 89        /// interface. Otherwise, use the webSearchUrl URL.
 90        /// </summary>
 91        [JsonProperty(PropertyName = "searchLink")]
 13092        public string SearchLink { get; private set; }
 93
 94        /// <summary>
 95        /// Gets the URL to a thumbnail of a related image.
 96        /// </summary>
 97        [JsonProperty(PropertyName = "thumbnail")]
 43298        public ImageObject Thumbnail { get; private set; }
 99
 100        /// <summary>
 101        /// Validate the object.
 102        /// </summary>
 103        /// <exception cref="ValidationException">
 104        /// Thrown if validation fails
 105        /// </exception>
 106        public virtual void Validate()
 107        {
 0108            if (Text == null)
 109            {
 0110                throw new ValidationException(ValidationRules.CannotBeNull, "Text");
 111            }
 0112        }
 113    }
 114}