< Summary

Class:Microsoft.Azure.CognitiveServices.Personalizer.Models.PolicyContract
Assembly:Microsoft.Azure.CognitiveServices.Personalizer
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Personalizer\src\Generated\Models\PolicyContract.cs
Covered lines:11
Uncovered lines:8
Coverable lines:19
Total lines:91
Line coverage:57.8% (11 of 19)
Covered branches:8
Total branches:12
Branch coverage:66.6% (8 of 12)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-0%100%
get_Name()-100%100%
get_Arguments()-100%100%
Validate()-63.64%66.67%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Personalizer\src\Generated\Models\PolicyContract.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    /// Learning settings specifying how to train the model.
 19    /// </summary>
 20    public partial class PolicyContract
 21    {
 22        /// <summary>
 23        /// Initializes a new instance of the PolicyContract class.
 24        /// </summary>
 1025        public PolicyContract()
 26        {
 27            CustomInit();
 1028        }
 29
 30        /// <summary>
 31        /// Initializes a new instance of the PolicyContract class.
 32        /// </summary>
 33        /// <param name="name">Name of the Learning settings.</param>
 34        /// <param name="arguments">Arguments of the Learning settings.</param>
 035        public PolicyContract(string name, string arguments)
 36        {
 037            Name = name;
 038            Arguments = arguments;
 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 or sets name of the Learning settings.
 49        /// </summary>
 50        [JsonProperty(PropertyName = "name")]
 2851        public string Name { get; set; }
 52
 53        /// <summary>
 54        /// Gets or sets arguments of the Learning settings.
 55        /// </summary>
 56        [JsonProperty(PropertyName = "arguments")]
 3457        public string Arguments { get; 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        {
 467            if (Name == null)
 68            {
 069                throw new ValidationException(ValidationRules.CannotBeNull, "Name");
 70            }
 471            if (Arguments == null)
 72            {
 073                throw new ValidationException(ValidationRules.CannotBeNull, "Arguments");
 74            }
 475            if (Name != null)
 76            {
 477                if (Name.Length > 256)
 78                {
 079                    throw new ValidationException(ValidationRules.MaxLength, "Name", 256);
 80                }
 81            }
 482            if (Arguments != null)
 83            {
 484                if (Arguments.Length > 1024)
 85                {
 086                    throw new ValidationException(ValidationRules.MaxLength, "Arguments", 1024);
 87                }
 88            }
 489        }
 90    }
 91}