< Summary

Class:Microsoft.Azure.CognitiveServices.ContentModerator.Models.CreateReviewBodyItem
Assembly:Microsoft.Azure.CognitiveServices.Vision.ContentModerator
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Vision.ContentModerator\src\Generated\Models\CreateReviewBodyItem.cs
Covered lines:22
Uncovered lines:3
Coverable lines:25
Total lines:115
Line coverage:88% (22 of 25)
Covered branches:9
Total branches:12
Branch coverage:75% (9 of 12)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Type()-100%100%
get_Content()-100%100%
get_ContentId()-100%100%
get_CallbackEndpoint()-100%100%
get_Metadata()-100%100%
Validate()-72.73%75%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Vision.ContentModerator\src\Generated\Models\CreateReviewBodyItem.cs

#LineLine coverage
 1// <auto-generated>
 2// Code generated by Microsoft (R) AutoRest Code Generator.
 3// Changes may cause incorrect behavior and will be lost if the code is
 4// regenerated.
 5// </auto-generated>
 6
 7namespace Microsoft.Azure.CognitiveServices.ContentModerator.Models
 8{
 9    using Microsoft.Rest;
 10    using Newtonsoft.Json;
 11    using System.Collections;
 12    using System.Collections.Generic;
 13    using System.Linq;
 14
 15    /// <summary>
 16    /// Schema items of the body.
 17    /// </summary>
 18    public partial class CreateReviewBodyItem
 19    {
 20        /// <summary>
 21        /// Initializes a new instance of the CreateReviewBodyItem class.
 22        /// </summary>
 523        public CreateReviewBodyItem()
 24        {
 25            CustomInit();
 526        }
 27
 28        /// <summary>
 29        /// Initializes a new instance of the CreateReviewBodyItem class.
 30        /// </summary>
 31        /// <param name="type">Type of the content. Possible values include:
 32        /// 'Image', 'Text'</param>
 33        /// <param name="content">Content to review.</param>
 34        /// <param name="contentId">Content Identifier.</param>
 35        /// <param name="callbackEndpoint">Optional CallbackEndpoint.</param>
 36        /// <param name="metadata">Optional metadata details.</param>
 437        public CreateReviewBodyItem(string type, string content, string contentId, string callbackEndpoint = default(str
 38        {
 439            Type = type;
 440            Content = content;
 441            ContentId = contentId;
 442            CallbackEndpoint = callbackEndpoint;
 443            Metadata = metadata;
 44            CustomInit();
 445        }
 46
 47        /// <summary>
 48        /// An initialization method that performs custom operations like setting defaults
 49        /// </summary>
 50        partial void CustomInit();
 51
 52        /// <summary>
 53        /// Gets or sets type of the content. Possible values include: 'Image',
 54        /// 'Text'
 55        /// </summary>
 56        [JsonProperty(PropertyName = "Type")]
 657        public string Type { get; set; }
 58
 59        /// <summary>
 60        /// Gets or sets content to review.
 61        /// </summary>
 62        [JsonProperty(PropertyName = "Content")]
 663        public string Content { get; set; }
 64
 65        /// <summary>
 66        /// Gets or sets content Identifier.
 67        /// </summary>
 68        [JsonProperty(PropertyName = "ContentId")]
 669        public string ContentId { get; set; }
 70
 71        /// <summary>
 72        /// Gets or sets optional CallbackEndpoint.
 73        /// </summary>
 74        [JsonProperty(PropertyName = "CallbackEndpoint")]
 575        public string CallbackEndpoint { get; set; }
 76
 77        /// <summary>
 78        /// Gets or sets optional metadata details.
 79        /// </summary>
 80        [JsonProperty(PropertyName = "Metadata")]
 781        public IList<CreateReviewBodyItemMetadataItem> Metadata { get; set; }
 82
 83        /// <summary>
 84        /// Validate the object.
 85        /// </summary>
 86        /// <exception cref="ValidationException">
 87        /// Thrown if validation fails
 88        /// </exception>
 89        public virtual void Validate()
 90        {
 191            if (Type == null)
 92            {
 093                throw new ValidationException(ValidationRules.CannotBeNull, "Type");
 94            }
 195            if (Content == null)
 96            {
 097                throw new ValidationException(ValidationRules.CannotBeNull, "Content");
 98            }
 199            if (ContentId == null)
 100            {
 0101                throw new ValidationException(ValidationRules.CannotBeNull, "ContentId");
 102            }
 1103            if (Metadata != null)
 104            {
 4105                foreach (var element in Metadata)
 106                {
 1107                    if (element != null)
 108                    {
 1109                        element.Validate();
 110                    }
 111                }
 112            }
 1113        }
 114    }
 115}