< Summary

Class:Microsoft.Azure.CognitiveServices.Search.ImageSearch.Models.TrendingImagesCategory
Assembly:Microsoft.Azure.CognitiveServices.Search.BingImageSearch
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingImageSearch\src\Generated\ImageSearch\Models\TrendingImagesCategory.cs
Covered lines:4
Uncovered lines:13
Coverable lines:17
Total lines:95
Line coverage:23.5% (4 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_Title()-100%100%
get_Tiles()-100%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingImageSearch\src\Generated\ImageSearch\Models\TrendingImagesCategory.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 category of trending images.
 17    /// </summary>
 18    public partial class TrendingImagesCategory
 19    {
 20        /// <summary>
 21        /// Initializes a new instance of the TrendingImagesCategory class.
 22        /// </summary>
 1423        public TrendingImagesCategory()
 24        {
 25            CustomInit();
 1426        }
 27
 28        /// <summary>
 29        /// Initializes a new instance of the TrendingImagesCategory class.
 30        /// </summary>
 31        /// <param name="title">The name of the image category. For example,
 32        /// Popular People Searches.</param>
 33        /// <param name="tiles">A list of images that are trending in the
 34        /// category. Each tile contains an image and a URL that returns more
 35        /// images of the subject. For example, if the category is Popular
 36        /// People Searches, the image is of a popular person and the URL would
 37        /// return more images of that person.</param>
 038        public TrendingImagesCategory(string title, IList<TrendingImagesTile> tiles)
 39        {
 040            Title = title;
 041            Tiles = tiles;
 42            CustomInit();
 043        }
 44
 45        /// <summary>
 46        /// An initialization method that performs custom operations like setting defaults
 47        /// </summary>
 48        partial void CustomInit();
 49
 50        /// <summary>
 51        /// Gets or sets the name of the image category. For example, Popular
 52        /// People Searches.
 53        /// </summary>
 54        [JsonProperty(PropertyName = "title")]
 1655        public string Title { get; set; }
 56
 57        /// <summary>
 58        /// Gets or sets a list of images that are trending in the category.
 59        /// Each tile contains an image and a URL that returns more images of
 60        /// the subject. For example, if the category is Popular People
 61        /// Searches, the image is of a popular person and the URL would return
 62        /// more images of that person.
 63        /// </summary>
 64        [JsonProperty(PropertyName = "tiles")]
 3465        public IList<TrendingImagesTile> Tiles { get; set; }
 66
 67        /// <summary>
 68        /// Validate the object.
 69        /// </summary>
 70        /// <exception cref="ValidationException">
 71        /// Thrown if validation fails
 72        /// </exception>
 73        public virtual void Validate()
 74        {
 075            if (Title == null)
 76            {
 077                throw new ValidationException(ValidationRules.CannotBeNull, "Title");
 78            }
 079            if (Tiles == null)
 80            {
 081                throw new ValidationException(ValidationRules.CannotBeNull, "Tiles");
 82            }
 083            if (Tiles != null)
 84            {
 085                foreach (var element in Tiles)
 86                {
 087                    if (element != null)
 88                    {
 089                        element.Validate();
 90                    }
 91                }
 92            }
 093        }
 94    }
 95}