< Summary

Class:Microsoft.Azure.CognitiveServices.Personalizer.Models.RankedAction
Assembly:Microsoft.Azure.CognitiveServices.Personalizer
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Personalizer\src\Generated\Models\RankedAction.cs
Covered lines:3
Uncovered lines:13
Coverable lines:16
Total lines:84
Line coverage:18.7% (3 of 16)
Covered branches:0
Total branches:8
Branch coverage:0% (0 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-0%100%
get_Id()-100%100%
get_Probability()-0%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Personalizer\src\Generated\Models\RankedAction.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.CognitiveServices.Personalizer.Models
 12{
 13    using Microsoft.Rest;
 14    using Newtonsoft.Json;
 15    using System.Linq;
 16
 17    /// <summary>
 18    /// A ranked action with its resulting probability.
 19    /// </summary>
 20    public partial class RankedAction
 21    {
 22        /// <summary>
 23        /// Initializes a new instance of the RankedAction class.
 24        /// </summary>
 625        public RankedAction()
 26        {
 27            CustomInit();
 628        }
 29
 30        /// <summary>
 31        /// Initializes a new instance of the RankedAction class.
 32        /// </summary>
 33        /// <param name="id">Id of the action</param>
 34        /// <param name="probability">Probability of the action</param>
 035        public RankedAction(string id = default(string), double? probability = default(double?))
 36        {
 037            Id = id;
 038            Probability = probability;
 39            CustomInit();
 040        }
 41
 42        /// <summary>
 43        /// An initialization method that performs custom operations like setting defaults
 44        /// </summary>
 45        partial void CustomInit();
 46
 47        /// <summary>
 48        /// Gets id of the action
 49        /// </summary>
 50        [JsonProperty(PropertyName = "id")]
 1251        public string Id { get; private set; }
 52
 53        /// <summary>
 54        /// Gets probability of the action
 55        /// </summary>
 56        [JsonProperty(PropertyName = "probability")]
 057        public double? Probability { get; private set; }
 58
 59        /// <summary>
 60        /// Validate the object.
 61        /// </summary>
 62        /// <exception cref="ValidationException">
 63        /// Thrown if validation fails
 64        /// </exception>
 65        public virtual void Validate()
 66        {
 067            if (Id != null)
 68            {
 069                if (Id.Length > 256)
 70                {
 071                    throw new ValidationException(ValidationRules.MaxLength, "Id", 256);
 72                }
 73            }
 074            if (Probability > 1)
 75            {
 076                throw new ValidationException(ValidationRules.InclusiveMaximum, "Probability", 1);
 77            }
 078            if (Probability < 0)
 79            {
 080                throw new ValidationException(ValidationRules.InclusiveMinimum, "Probability", 0);
 81            }
 082        }
 83    }
 84}