< Summary

Class:Microsoft.Azure.Search.Models.Suggester
Assembly:Microsoft.Azure.Search.Service
File(s):C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Customizations\Indexes\Models\Suggester.Customization.cs
C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\Models\Suggester.cs
Covered lines:16
Uncovered lines:2
Coverable lines:18
Total lines:122
Line coverage:88.8% (16 of 18)
Covered branches:2
Total branches:4
Branch coverage:50% (2 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
.cctor()-100%100%
get_Name()-100%100%
get_SourceFields()-100%100%
get_SearchMode()-100%100%
Validate()-60%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Customizations\Indexes\Models\Suggester.Customization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for
 3// license information.
 4
 5namespace Microsoft.Azure.Search.Models
 6{
 7    using System.Linq;
 8
 9    /// <summary>
 10    /// Defines how the Suggest API should apply to a group of fields in the
 11    /// index.
 12    /// </summary>
 13    public partial class Suggester
 14    {
 15        /// <summary>
 16        /// Initializes a new instance of the Suggester class with required
 17        /// arguments.
 18        /// </summary>
 19        /// <param name="name">The name of the suggester.</param>
 20        /// <param name="sourceFields">The list of field names to which the suggester applies; Each field must be
 21        /// searchable.</param>
 51822        public Suggester(string name, params string[] sourceFields) : this(name, sourceFields.ToList())
 23        {
 24            // Do nothing.
 51825        }
 26    }
 27}

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\Models\Suggester.cs

#LineLine coverage
 1// <auto-generated>
 2// Copyright (c) Microsoft Corporation. All rights reserved.
 3// Licensed under the MIT License. See License.txt in the project root for
 4// license information.
 5//
 6// Code generated by Microsoft (R) AutoRest Code Generator.
 7// Changes may cause incorrect behavior and will be lost if the code is
 8// regenerated.
 9// </auto-generated>
 10
 11namespace Microsoft.Azure.Search.Models
 12{
 13    using Microsoft.Rest;
 14    using Newtonsoft.Json;
 15    using System.Collections;
 16    using System.Collections.Generic;
 17    using System.Linq;
 18
 19    /// <summary>
 20    /// Defines how the Suggest API should apply to a group of fields in the
 21    /// index.
 22    /// </summary>
 23    public partial class Suggester
 24    {
 25        /// <summary>
 26        /// Initializes a new instance of the Suggester class.
 27        /// </summary>
 53028        public Suggester()
 29        {
 30            CustomInit();
 53031        }
 32
 33        /// <summary>
 34        /// Initializes a new instance of the Suggester class.
 35        /// </summary>
 36        /// <param name="name">The name of the suggester.</param>
 37        /// <param name="sourceFields">The list of field names to which the
 38        /// suggester applies. Each field must be searchable.</param>
 51839        public Suggester(string name, IList<string> sourceFields)
 40        {
 51841            Name = name;
 51842            SourceFields = sourceFields;
 43            CustomInit();
 51844        }
 45        /// <summary>
 46        /// Static constructor for Suggester class.
 47        /// </summary>
 48        static Suggester()
 49        {
 250            SearchMode = "analyzingInfixMatching";
 251        }
 52
 53        /// <summary>
 54        /// An initialization method that performs custom operations like setting defaults
 55        /// </summary>
 56        partial void CustomInit();
 57
 58        /// <summary>
 59        /// Gets or sets the name of the suggester.
 60        /// </summary>
 61        [JsonProperty(PropertyName = "name")]
 211662        public string Name { get; set; }
 63
 64        /// <summary>
 65        /// Gets or sets the list of field names to which the suggester
 66        /// applies. Each field must be searchable.
 67        /// </summary>
 68        [JsonProperty(PropertyName = "sourceFields")]
 264669        public IList<string> SourceFields { get; set; }
 70
 71        /// <summary>
 72        /// A value indicating the capabilities of the suggester.
 73        /// </summary>
 74        [JsonProperty(PropertyName = "searchMode")]
 105675        public static string SearchMode { get; private set; }
 76
 77        /// <summary>
 78        /// Validate the object.
 79        /// </summary>
 80        /// <exception cref="ValidationException">
 81        /// Thrown if validation fails
 82        /// </exception>
 83        public virtual void Validate()
 84        {
 52485            if (Name == null)
 86            {
 087                throw new ValidationException(ValidationRules.CannotBeNull, "Name");
 88            }
 52489            if (SourceFields == null)
 90            {
 091                throw new ValidationException(ValidationRules.CannotBeNull, "SourceFields");
 92            }
 52493        }
 94    }
 95}