< Summary

Class:Microsoft.Azure.Search.Models.FreshnessScoringFunction
Assembly:Microsoft.Azure.Search.Service
File(s):C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Customizations\Indexes\Models\FreshnessScoringFunction.Customization.cs
C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\Models\FreshnessScoringFunction.cs
Covered lines:13
Uncovered lines:1
Coverable lines:14
Total lines:111
Line coverage:92.8% (13 of 14)
Covered branches:3
Total branches:4
Branch coverage:75% (3 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
get_Parameters()-100%100%
Validate()-83.33%75%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Customizations\Indexes\Models\FreshnessScoringFunction.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;
 8    using Microsoft.Rest;
 9    using Newtonsoft.Json;
 10
 11    public partial class FreshnessScoringFunction
 12    {
 13        /// <summary>
 14        /// Initializes a new instance of the FreshnessScoringFunction class.
 15        /// </summary>
 16        public FreshnessScoringFunction(
 17            string fieldName,
 18            double boost,
 19            TimeSpan boostingDuration,
 20            ScoringFunctionInterpolation? interpolation = default(ScoringFunctionInterpolation?))
 9421            : this(fieldName, boost, new FreshnessScoringParameters(boostingDuration), interpolation)
 22        {
 23            // Initialization done by other constructor.
 9424        }
 25    }
 26}

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\Models\FreshnessScoringFunction.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.Linq;
 16
 17    /// <summary>
 18    /// Defines a function that boosts scores based on the value of a date-time
 19    /// field.
 20    /// <see
 21    /// href="https://docs.microsoft.com/rest/api/searchservice/Add-scoring-profiles-to-a-search-index"
 22    /// />
 23    /// </summary>
 24    [Newtonsoft.Json.JsonObject("freshness")]
 25    public partial class FreshnessScoringFunction : ScoringFunction
 26    {
 27        /// <summary>
 28        /// Initializes a new instance of the FreshnessScoringFunction class.
 29        /// </summary>
 8830        public FreshnessScoringFunction()
 31        {
 32            CustomInit();
 8833        }
 34
 35        /// <summary>
 36        /// Initializes a new instance of the FreshnessScoringFunction class.
 37        /// </summary>
 38        /// <param name="fieldName">The name of the field used as input to the
 39        /// scoring function.</param>
 40        /// <param name="boost">A multiplier for the raw score. Must be a
 41        /// positive number not equal to 1.0.</param>
 42        /// <param name="parameters">Parameter values for the freshness scoring
 43        /// function.</param>
 44        /// <param name="interpolation">A value indicating how boosting will be
 45        /// interpolated across document scores; defaults to "Linear". Possible
 46        /// values include: 'linear', 'constant', 'quadratic',
 47        /// 'logarithmic'</param>
 48        public FreshnessScoringFunction(string fieldName, double boost, FreshnessScoringParameters parameters, ScoringFu
 9449            : base(fieldName, boost, interpolation)
 50        {
 9451            Parameters = parameters;
 52            CustomInit();
 9453        }
 54
 55        /// <summary>
 56        /// An initialization method that performs custom operations like setting defaults
 57        /// </summary>
 58        partial void CustomInit();
 59
 60        /// <summary>
 61        /// Gets or sets parameter values for the freshness scoring function.
 62        /// </summary>
 63        [JsonProperty(PropertyName = "freshness")]
 56264        public FreshnessScoringParameters Parameters { get; set; }
 65
 66        /// <summary>
 67        /// Validate the object.
 68        /// </summary>
 69        /// <exception cref="ValidationException">
 70        /// Thrown if validation fails
 71        /// </exception>
 72        public override void Validate()
 73        {
 9074            base.Validate();
 9075            if (Parameters == null)
 76            {
 077                throw new ValidationException(ValidationRules.CannotBeNull, "Parameters");
 78            }
 9079            if (Parameters != null)
 80            {
 9081                Parameters.Validate();
 82            }
 9083        }
 84    }
 85}