< Summary

Class:Microsoft.Azure.Search.Models.TextWeights
Assembly:Microsoft.Azure.Search.Service
File(s):C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\Models\TextWeights.cs
Covered lines:5
Uncovered lines:4
Coverable lines:9
Total lines:72
Line coverage:55.5% (5 of 9)
Covered branches:1
Total branches:2
Branch coverage:50% (1 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-0%100%
get_Weights()-100%100%
Validate()-66.67%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\Models\TextWeights.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 weights on index fields for which matches should boost scoring
 21    /// in search queries.
 22    /// </summary>
 23    public partial class TextWeights
 24    {
 25        /// <summary>
 26        /// Initializes a new instance of the TextWeights class.
 27        /// </summary>
 18228        public TextWeights()
 29        {
 30            CustomInit();
 18231        }
 32
 33        /// <summary>
 34        /// Initializes a new instance of the TextWeights class.
 35        /// </summary>
 36        /// <param name="weights">The dictionary of per-field weights to boost
 37        /// document scoring. The keys are field names and the values are the
 38        /// weights for each field.</param>
 039        public TextWeights(IDictionary<string, double> weights)
 40        {
 041            Weights = weights;
 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 dictionary of per-field weights to boost document
 52        /// scoring. The keys are field names and the values are the weights
 53        /// for each field.
 54        /// </summary>
 55        [JsonProperty(PropertyName = "weights")]
 47056        public IDictionary<string, double> Weights { get; set; }
 57
 58        /// <summary>
 59        /// Validate the object.
 60        /// </summary>
 61        /// <exception cref="ValidationException">
 62        /// Thrown if validation fails
 63        /// </exception>
 64        public virtual void Validate()
 65        {
 9066            if (Weights == null)
 67            {
 068                throw new ValidationException(ValidationRules.CannotBeNull, "Weights");
 69            }
 9070        }
 71    }
 72}