< Summary

Class:Microsoft.Azure.CognitiveServices.Vision.Face.Models.NameAndUserDataContract
Assembly:Microsoft.Azure.CognitiveServices.Vision.Face
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Vision.Face\src\Generated\Models\NameAndUserDataContract.cs
Covered lines:4
Uncovered lines:11
Coverable lines:15
Total lines:86
Line coverage:26.6% (4 of 15)
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_Name()-100%100%
get_UserData()-100%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Vision.Face\src\Generated\Models\NameAndUserDataContract.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.Vision.Face.Models
 12{
 13    using Microsoft.Rest;
 14    using Newtonsoft.Json;
 15    using System.Linq;
 16
 17    /// <summary>
 18    /// A combination of user defined name and user specified data for the
 19    /// person, largePersonGroup/personGroup, and largeFaceList/faceList.
 20    /// </summary>
 21    public partial class NameAndUserDataContract
 22    {
 23        /// <summary>
 24        /// Initializes a new instance of the NameAndUserDataContract class.
 25        /// </summary>
 7626        public NameAndUserDataContract()
 27        {
 28            CustomInit();
 7629        }
 30
 31        /// <summary>
 32        /// Initializes a new instance of the NameAndUserDataContract class.
 33        /// </summary>
 34        /// <param name="name">User defined name, maximum length is
 35        /// 128.</param>
 36        /// <param name="userData">User specified data. Length should not
 37        /// exceed 16KB.</param>
 038        public NameAndUserDataContract(string name = default(string), string userData = default(string))
 39        {
 040            Name = name;
 041            UserData = userData;
 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 user defined name, maximum length is 128.
 52        /// </summary>
 53        [JsonProperty(PropertyName = "name")]
 10054        public string Name { get; set; }
 55
 56        /// <summary>
 57        /// Gets or sets user specified data. Length should not exceed 16KB.
 58        /// </summary>
 59        [JsonProperty(PropertyName = "userData")]
 10060        public string UserData { 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        {
 070            if (Name != null)
 71            {
 072                if (Name.Length > 128)
 73                {
 074                    throw new ValidationException(ValidationRules.MaxLength, "Name", 128);
 75                }
 76            }
 077            if (UserData != null)
 78            {
 079                if (UserData.Length > 16384)
 80                {
 081                    throw new ValidationException(ValidationRules.MaxLength, "UserData", 16384);
 82                }
 83            }
 084        }
 85    }
 86}