< Summary

Class:Microsoft.Azure.CognitiveServices.Personalizer.Models.RankResponse
Assembly:Microsoft.Azure.CognitiveServices.Personalizer
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Personalizer\src\Generated\Models\RankResponse.cs
Covered lines:4
Uncovered lines:17
Coverable lines:21
Total lines:114
Line coverage:19% (4 of 21)
Covered branches:0
Total branches:14
Branch coverage:0% (0 of 14)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-0%100%
get_Ranking()-100%100%
get_EventId()-100%100%
get_RewardActionId()-0%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Personalizer\src\Generated\Models\RankResponse.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    /// Returns which action to use as rewardActionId, and additional
 21    /// information about each action as a result of a Rank request.
 22    /// </summary>
 23    public partial class RankResponse
 24    {
 25        /// <summary>
 26        /// Initializes a new instance of the RankResponse class.
 27        /// </summary>
 428        public RankResponse()
 29        {
 30            CustomInit();
 431        }
 32
 33        /// <summary>
 34        /// Initializes a new instance of the RankResponse class.
 35        /// </summary>
 36        /// <param name="ranking">The calculated ranking for the current
 37        /// request.</param>
 38        /// <param name="eventId">The eventId for the round trip from request
 39        /// to response.</param>
 40        /// <param name="rewardActionId">The action chosen by the Personalizer
 41        /// service. This is the action your application should display, and
 42        /// for which to report the reward. This might not be the
 43        /// first found in 'ranking' if an action in the request in first
 44        /// position was part of the excluded ids.</param>
 045        public RankResponse(IList<RankedAction> ranking = default(IList<RankedAction>), string eventId = default(string)
 46        {
 047            Ranking = ranking;
 048            EventId = eventId;
 049            RewardActionId = rewardActionId;
 50            CustomInit();
 051        }
 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 the calculated ranking for the current request.
 60        /// </summary>
 61        [JsonProperty(PropertyName = "ranking")]
 2862        public IList<RankedAction> Ranking { get; private set; }
 63
 64        /// <summary>
 65        /// Gets the eventId for the round trip from request to response.
 66        /// </summary>
 67        [JsonProperty(PropertyName = "eventId")]
 668        public string EventId { get; private set; }
 69
 70        /// <summary>
 71        /// Gets the action chosen by the Personalizer service. This is the
 72        /// action your application should display, and for which to report the
 73        /// reward. This might not be the
 74        /// first found in 'ranking' if an action in the request in first
 75        /// position was part of the excluded ids.
 76        /// </summary>
 77        [JsonProperty(PropertyName = "rewardActionId")]
 078        public string RewardActionId { get; private set; }
 79
 80        /// <summary>
 81        /// Validate the object.
 82        /// </summary>
 83        /// <exception cref="ValidationException">
 84        /// Thrown if validation fails
 85        /// </exception>
 86        public virtual void Validate()
 87        {
 088            if (Ranking != null)
 89            {
 090                foreach (var element in Ranking)
 91                {
 092                    if (element != null)
 93                    {
 094                        element.Validate();
 95                    }
 96                }
 97            }
 098            if (EventId != null)
 99            {
 0100                if (EventId.Length > 256)
 101                {
 0102                    throw new ValidationException(ValidationRules.MaxLength, "EventId", 256);
 103                }
 104            }
 0105            if (RewardActionId != null)
 106            {
 0107                if (RewardActionId.Length > 256)
 108                {
 0109                    throw new ValidationException(ValidationRules.MaxLength, "RewardActionId", 256);
 110                }
 111            }
 0112        }
 113    }
 114}