< Summary

Class:Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker.Models.MetadataDTO
Assembly:Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Knowledge.QnAMaker\src\Generated\Models\MetadataDTO.cs
Covered lines:0
Uncovered lines:23
Coverable lines:23
Total lines:99
Line coverage:0% (0 of 23)
Covered branches:0
Total branches:16
Branch coverage:0% (0 of 16)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
get_Name()-0%100%
get_Value()-0%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Knowledge.QnAMaker\src\Generated\Models\MetadataDTO.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.Knowledge.QnAMaker.Models
 12{
 13    using Microsoft.Rest;
 14    using Newtonsoft.Json;
 15    using System.Linq;
 16
 17    /// <summary>
 18    /// Name - value pair of metadata.
 19    /// </summary>
 20    public partial class MetadataDTO
 21    {
 22        /// <summary>
 23        /// Initializes a new instance of the MetadataDTO class.
 24        /// </summary>
 025        public MetadataDTO()
 26        {
 27            CustomInit();
 028        }
 29
 30        /// <summary>
 31        /// Initializes a new instance of the MetadataDTO class.
 32        /// </summary>
 33        /// <param name="name">Metadata name.</param>
 34        /// <param name="value">Metadata value.</param>
 035        public MetadataDTO(string name, string value)
 36        {
 037            Name = name;
 038            Value = value;
 39            CustomInit();
 040        }
 41
 42        /// <summary>
 43        /// An initialization method that performs custom operations like setting defaults
 44        /// </summary>
 45        partial void CustomInit();
 46
 47        /// <summary>
 48        /// Gets or sets metadata name.
 49        /// </summary>
 50        [JsonProperty(PropertyName = "name")]
 051        public string Name { get; set; }
 52
 53        /// <summary>
 54        /// Gets or sets metadata value.
 55        /// </summary>
 56        [JsonProperty(PropertyName = "value")]
 057        public string Value { get; set; }
 58
 59        /// <summary>
 60        /// Validate the object.
 61        /// </summary>
 62        /// <exception cref="ValidationException">
 63        /// Thrown if validation fails
 64        /// </exception>
 65        public virtual void Validate()
 66        {
 067            if (Name == null)
 68            {
 069                throw new ValidationException(ValidationRules.CannotBeNull, "Name");
 70            }
 071            if (Value == null)
 72            {
 073                throw new ValidationException(ValidationRules.CannotBeNull, "Value");
 74            }
 075            if (Name != null)
 76            {
 077                if (Name.Length > 100)
 78                {
 079                    throw new ValidationException(ValidationRules.MaxLength, "Name", 100);
 80                }
 081                if (Name.Length < 1)
 82                {
 083                    throw new ValidationException(ValidationRules.MinLength, "Name", 1);
 84                }
 85            }
 086            if (Value != null)
 87            {
 088                if (Value.Length > 500)
 89                {
 090                    throw new ValidationException(ValidationRules.MaxLength, "Value", 500);
 91                }
 092                if (Value.Length < 1)
 93                {
 094                    throw new ValidationException(ValidationRules.MinLength, "Value", 1);
 95                }
 96            }
 097        }
 98    }
 99}