< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
get_FileName()-0%100%
get_FileUri()-0%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Knowledge.QnAMaker\src\Generated\Models\FileDTO.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    /// DTO to hold details of uploaded files.
 19    /// </summary>
 20    public partial class FileDTO
 21    {
 22        /// <summary>
 23        /// Initializes a new instance of the FileDTO class.
 24        /// </summary>
 025        public FileDTO()
 26        {
 27            CustomInit();
 028        }
 29
 30        /// <summary>
 31        /// Initializes a new instance of the FileDTO class.
 32        /// </summary>
 33        /// <param name="fileName">File name. Supported file types are ".tsv",
 34        /// ".pdf", ".txt", ".docx", ".xlsx".</param>
 35        /// <param name="fileUri">Public URI of the file.</param>
 036        public FileDTO(string fileName, string fileUri)
 37        {
 038            FileName = fileName;
 039            FileUri = fileUri;
 40            CustomInit();
 041        }
 42
 43        /// <summary>
 44        /// An initialization method that performs custom operations like setting defaults
 45        /// </summary>
 46        partial void CustomInit();
 47
 48        /// <summary>
 49        /// Gets or sets file name. Supported file types are ".tsv", ".pdf",
 50        /// ".txt", ".docx", ".xlsx".
 51        /// </summary>
 52        [JsonProperty(PropertyName = "fileName")]
 053        public string FileName { get; set; }
 54
 55        /// <summary>
 56        /// Gets or sets public URI of the file.
 57        /// </summary>
 58        [JsonProperty(PropertyName = "fileUri")]
 059        public string FileUri { get; set; }
 60
 61        /// <summary>
 62        /// Validate the object.
 63        /// </summary>
 64        /// <exception cref="ValidationException">
 65        /// Thrown if validation fails
 66        /// </exception>
 67        public virtual void Validate()
 68        {
 069            if (FileName == null)
 70            {
 071                throw new ValidationException(ValidationRules.CannotBeNull, "FileName");
 72            }
 073            if (FileUri == null)
 74            {
 075                throw new ValidationException(ValidationRules.CannotBeNull, "FileUri");
 76            }
 077            if (FileName != null)
 78            {
 079                if (FileName.Length > 200)
 80                {
 081                    throw new ValidationException(ValidationRules.MaxLength, "FileName", 200);
 82                }
 083                if (FileName.Length < 1)
 84                {
 085                    throw new ValidationException(ValidationRules.MinLength, "FileName", 1);
 86                }
 87            }
 088        }
 89    }
 90}