< Summary

Class:Microsoft.Azure.CognitiveServices.Personalizer.Models.RankableAction
Assembly:Microsoft.Azure.CognitiveServices.Personalizer
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Personalizer\src\Generated\Models\RankableAction.cs
Covered lines:9
Uncovered lines:7
Coverable lines:16
Total lines:87
Line coverage:56.2% (9 of 16)
Covered branches:5
Total branches:8
Branch coverage:62.5% (5 of 8)

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Personalizer\src\Generated\Models\RankableAction.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.Collections;
 16    using System.Collections.Generic;
 17    using System.Linq;
 18
 19    /// <summary>
 20    /// An action with it's associated features used for ranking.
 21    /// </summary>
 22    public partial class RankableAction
 23    {
 24        /// <summary>
 25        /// Initializes a new instance of the RankableAction class.
 26        /// </summary>
 627        public RankableAction()
 28        {
 29            CustomInit();
 630        }
 31
 32        /// <summary>
 33        /// Initializes a new instance of the RankableAction class.
 34        /// </summary>
 35        /// <param name="id">Id of the action.</param>
 36        /// <param name="features">List of dictionaries containing
 37        /// features.</param>
 038        public RankableAction(string id, IList<object> features)
 39        {
 040            Id = id;
 041            Features = features;
 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 id of the action.
 52        /// </summary>
 53        [JsonProperty(PropertyName = "id")]
 3654        public string Id { get; set; }
 55
 56        /// <summary>
 57        /// Gets or sets list of dictionaries containing features.
 58        /// </summary>
 59        [JsonProperty(PropertyName = "features")]
 1860        public IList<object> Features { get; set; }
 61
 62        /// <summary>
 63        /// Validate the object.
 64        /// </summary>
 65        /// <exception cref="ValidationException">
 66        /// Thrown if validation fails
 67        /// </exception>
 68        public virtual void Validate()
 69        {
 670            if (Id == null)
 71            {
 072                throw new ValidationException(ValidationRules.CannotBeNull, "Id");
 73            }
 674            if (Features == null)
 75            {
 076                throw new ValidationException(ValidationRules.CannotBeNull, "Features");
 77            }
 678            if (Id != null)
 79            {
 680                if (Id.Length > 256)
 81                {
 082                    throw new ValidationException(ValidationRules.MaxLength, "Id", 256);
 83                }
 84            }
 685        }
 86    }
 87}