< Summary

Class:Microsoft.Azure.CognitiveServices.Vision.Face.Models.PersonGroup
Assembly:Microsoft.Azure.CognitiveServices.Vision.Face
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Vision.Face\src\Generated\Models\PersonGroup.cs
Covered lines:2
Uncovered lines:13
Coverable lines:15
Total lines:85
Line coverage:13.3% (2 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_PersonGroupId()-0%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Vision.Face\src\Generated\Models\PersonGroup.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    /// Person group object.
 19    /// </summary>
 20    public partial class PersonGroup : MetaDataContract
 21    {
 22        /// <summary>
 23        /// Initializes a new instance of the PersonGroup class.
 24        /// </summary>
 225        public PersonGroup()
 26        {
 27            CustomInit();
 228        }
 29
 30        /// <summary>
 31        /// Initializes a new instance of the PersonGroup class.
 32        /// </summary>
 33        /// <param name="personGroupId">PersonGroupId of the target person
 34        /// group.</param>
 35        /// <param name="name">User defined name, maximum length is
 36        /// 128.</param>
 37        /// <param name="userData">User specified data. Length should not
 38        /// exceed 16KB.</param>
 39        /// <param name="recognitionModel">Possible values include:
 40        /// 'recognition_01', 'recognition_02'</param>
 41        public PersonGroup(string personGroupId, string name = default(string), string userData = default(string), strin
 042            : base(name, userData, recognitionModel)
 43        {
 044            PersonGroupId = personGroupId;
 45            CustomInit();
 046        }
 47
 48        /// <summary>
 49        /// An initialization method that performs custom operations like setting defaults
 50        /// </summary>
 51        partial void CustomInit();
 52
 53        /// <summary>
 54        /// Gets or sets personGroupId of the target person group.
 55        /// </summary>
 56        [JsonProperty(PropertyName = "personGroupId")]
 057        public string PersonGroupId { get; set; }
 58
 59        /// <summary>
 60        /// Validate the object.
 61        /// </summary>
 62        /// <exception cref="ValidationException">
 63        /// Thrown if validation fails
 64        /// </exception>
 65        public override void Validate()
 66        {
 067            base.Validate();
 068            if (PersonGroupId == null)
 69            {
 070                throw new ValidationException(ValidationRules.CannotBeNull, "PersonGroupId");
 71            }
 072            if (PersonGroupId != null)
 73            {
 074                if (PersonGroupId.Length > 64)
 75                {
 076                    throw new ValidationException(ValidationRules.MaxLength, "PersonGroupId", 64);
 77                }
 078                if (!System.Text.RegularExpressions.Regex.IsMatch(PersonGroupId, "^[a-z0-9-_]+$"))
 79                {
 080                    throw new ValidationException(ValidationRules.Pattern, "PersonGroupId", "^[a-z0-9-_]+$");
 81                }
 82            }
 083        }
 84    }
 85}