< Summary

Class:Microsoft.Azure.CognitiveServices.Vision.Face.Models.TakeSnapshotRequest
Assembly:Microsoft.Azure.CognitiveServices.Vision.Face
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Vision.Face\src\Generated\Models\TakeSnapshotRequest.cs
Covered lines:6
Uncovered lines:19
Coverable lines:25
Total lines:128
Line coverage:24% (6 of 25)
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_Type()-100%100%
get_ObjectId()-100%100%
get_ApplyScope()-100%100%
get_UserData()-100%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Vision.Face\src\Generated\Models\TakeSnapshotRequest.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    /// Request body for taking snapshot operation.
 21    /// </summary>
 22    public partial class TakeSnapshotRequest
 23    {
 24        /// <summary>
 25        /// Initializes a new instance of the TakeSnapshotRequest class.
 26        /// </summary>
 827        public TakeSnapshotRequest()
 28        {
 29            CustomInit();
 830        }
 31
 32        /// <summary>
 33        /// Initializes a new instance of the TakeSnapshotRequest class.
 34        /// </summary>
 35        /// <param name="type">User specified type for the source object to
 36        /// take snapshot from. Currently FaceList, PersonGroup, LargeFaceList
 37        /// and LargePersonGroup are supported. Possible values include:
 38        /// 'FaceList', 'LargeFaceList', 'LargePersonGroup',
 39        /// 'PersonGroup'</param>
 40        /// <param name="objectId">User specified source object id to take
 41        /// snapshot from.</param>
 42        /// <param name="applyScope">User specified array of target Face
 43        /// subscription ids for the snapshot. For each snapshot, only
 44        /// subscriptions included in the applyScope of Snapshot - Take can
 45        /// apply it.</param>
 46        /// <param name="userData">User specified data about the snapshot for
 47        /// any purpose. Length should not exceed 16KB.</param>
 048        public TakeSnapshotRequest(SnapshotObjectType type, string objectId, IList<System.Guid> applyScope, string userD
 49        {
 050            Type = type;
 051            ObjectId = objectId;
 052            ApplyScope = applyScope;
 053            UserData = userData;
 54            CustomInit();
 055        }
 56
 57        /// <summary>
 58        /// An initialization method that performs custom operations like setting defaults
 59        /// </summary>
 60        partial void CustomInit();
 61
 62        /// <summary>
 63        /// Gets or sets user specified type for the source object to take
 64        /// snapshot from. Currently FaceList, PersonGroup, LargeFaceList and
 65        /// LargePersonGroup are supported. Possible values include:
 66        /// 'FaceList', 'LargeFaceList', 'LargePersonGroup', 'PersonGroup'
 67        /// </summary>
 68        [JsonProperty(PropertyName = "type")]
 1669        public SnapshotObjectType Type { get; set; }
 70
 71        /// <summary>
 72        /// Gets or sets user specified source object id to take snapshot from.
 73        /// </summary>
 74        [JsonProperty(PropertyName = "objectId")]
 1675        public string ObjectId { get; set; }
 76
 77        /// <summary>
 78        /// Gets or sets user specified array of target Face subscription ids
 79        /// for the snapshot. For each snapshot, only subscriptions included in
 80        /// the applyScope of Snapshot - Take can apply it.
 81        /// </summary>
 82        [JsonProperty(PropertyName = "applyScope")]
 1683        public IList<System.Guid> ApplyScope { get; set; }
 84
 85        /// <summary>
 86        /// Gets or sets user specified data about the snapshot for any
 87        /// purpose. Length should not exceed 16KB.
 88        /// </summary>
 89        [JsonProperty(PropertyName = "userData")]
 1690        public string UserData { get; set; }
 91
 92        /// <summary>
 93        /// Validate the object.
 94        /// </summary>
 95        /// <exception cref="ValidationException">
 96        /// Thrown if validation fails
 97        /// </exception>
 98        public virtual void Validate()
 99        {
 0100            if (ObjectId == null)
 101            {
 0102                throw new ValidationException(ValidationRules.CannotBeNull, "ObjectId");
 103            }
 0104            if (ApplyScope == null)
 105            {
 0106                throw new ValidationException(ValidationRules.CannotBeNull, "ApplyScope");
 107            }
 0108            if (ObjectId != null)
 109            {
 0110                if (ObjectId.Length > 64)
 111                {
 0112                    throw new ValidationException(ValidationRules.MaxLength, "ObjectId", 64);
 113                }
 0114                if (!System.Text.RegularExpressions.Regex.IsMatch(ObjectId, "^[a-z0-9-_]+$"))
 115                {
 0116                    throw new ValidationException(ValidationRules.Pattern, "ObjectId", "^[a-z0-9-_]+$");
 117                }
 118            }
 0119            if (UserData != null)
 120            {
 0121                if (UserData.Length > 16384)
 122                {
 0123                    throw new ValidationException(ValidationRules.MaxLength, "UserData", 16384);
 124                }
 125            }
 0126        }
 127    }
 128}