< Summary

Class:Microsoft.Azure.CognitiveServices.Vision.Face.Models.FaceList
Assembly:Microsoft.Azure.CognitiveServices.Vision.Face
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Vision.Face\src\Generated\Models\FaceList.cs
Covered lines:3
Uncovered lines:18
Coverable lines:21
Total lines:106
Line coverage:14.2% (3 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_FaceListId()-0%100%
get_PersistedFaces()-100%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Vision.Face\src\Generated\Models\FaceList.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.Collections;
 16    using System.Collections.Generic;
 17    using System.Linq;
 18
 19    /// <summary>
 20    /// Face list object.
 21    /// </summary>
 22    public partial class FaceList : MetaDataContract
 23    {
 24        /// <summary>
 25        /// Initializes a new instance of the FaceList class.
 26        /// </summary>
 227        public FaceList()
 28        {
 29            CustomInit();
 230        }
 31
 32        /// <summary>
 33        /// Initializes a new instance of the FaceList class.
 34        /// </summary>
 35        /// <param name="faceListId">FaceListId of the target face
 36        /// list.</param>
 37        /// <param name="name">User defined name, maximum length is
 38        /// 128.</param>
 39        /// <param name="userData">User specified data. Length should not
 40        /// exceed 16KB.</param>
 41        /// <param name="recognitionModel">Possible values include:
 42        /// 'recognition_01', 'recognition_02'</param>
 43        /// <param name="persistedFaces">Persisted faces within the face
 44        /// list.</param>
 45        public FaceList(string faceListId, string name = default(string), string userData = default(string), string reco
 046            : base(name, userData, recognitionModel)
 47        {
 048            FaceListId = faceListId;
 049            PersistedFaces = persistedFaces;
 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 or sets faceListId of the target face list.
 60        /// </summary>
 61        [JsonProperty(PropertyName = "faceListId")]
 062        public string FaceListId { get; set; }
 63
 64        /// <summary>
 65        /// Gets or sets persisted faces within the face list.
 66        /// </summary>
 67        [JsonProperty(PropertyName = "persistedFaces")]
 668        public IList<PersistedFace> PersistedFaces { get; set; }
 69
 70        /// <summary>
 71        /// Validate the object.
 72        /// </summary>
 73        /// <exception cref="ValidationException">
 74        /// Thrown if validation fails
 75        /// </exception>
 76        public override void Validate()
 77        {
 078            base.Validate();
 079            if (FaceListId == null)
 80            {
 081                throw new ValidationException(ValidationRules.CannotBeNull, "FaceListId");
 82            }
 083            if (FaceListId != null)
 84            {
 085                if (FaceListId.Length > 64)
 86                {
 087                    throw new ValidationException(ValidationRules.MaxLength, "FaceListId", 64);
 88                }
 089                if (!System.Text.RegularExpressions.Regex.IsMatch(FaceListId, "^[a-z0-9-_]+$"))
 90                {
 091                    throw new ValidationException(ValidationRules.Pattern, "FaceListId", "^[a-z0-9-_]+$");
 92                }
 93            }
 094            if (PersistedFaces != null)
 95            {
 096                foreach (var element in PersistedFaces)
 97                {
 098                    if (element != null)
 99                    {
 0100                        element.Validate();
 101                    }
 102                }
 103            }
 0104        }
 105    }
 106}