< Summary

Class:Azure.AI.FormRecognizer.Training.TrainingDocumentInfo
Assembly:Azure.AI.FormRecognizer
File(s):C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\TrainingDocumentInfo.cs
C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\TrainingDocumentInfo.Serialization.cs
C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\TrainingDocumentInfo.cs
Covered lines:30
Uncovered lines:11
Coverable lines:41
Total lines:138
Line coverage:73.1% (30 of 41)
Covered branches:11
Total branches:16
Branch coverage:68.7% (11 of 16)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_Name()-100%100%
.ctor(...)-10%0%
get_PageCount()-100%100%
.ctor(...)-100%100%
get_Errors()-100%100%
get_Status()-100%100%
DeserializeTrainingDocumentInfo(...)-90%91.67%
get_Name()-100%100%
get_PageCount()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\TrainingDocumentInfo.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Collections.Generic;
 10using System.Linq;
 11using Azure.AI.FormRecognizer.Models;
 12
 13namespace Azure.AI.FormRecognizer.Training
 14{
 15    /// <summary> Report for a custom model training document. </summary>
 16    public partial class TrainingDocumentInfo
 17    {
 42218        /// <summary> Initializes a new instance of TrainingDocumentInfo. </summary>
 19        /// <param name="name"> Training document name. </param>
 20        /// <param name="pageCount"> Total number of pages trained. </param>
 21        /// <param name="errors"> List of errors. </param>
 22        /// <param name="status"> Status of the training operation. </param>
 23        /// <exception cref="ArgumentNullException"> <paramref name="name"/> or <paramref name="errors"/> is null. </exc
 42224        internal TrainingDocumentInfo(string name, int pageCount, IEnumerable<FormRecognizerError> errors, TrainingStatu
 25        {
 026            if (name == null)
 27            {
 028                throw new ArgumentNullException(nameof(name));
 29            }
 030            if (errors == null)
 31            {
 032                throw new ArgumentNullException(nameof(errors));
 33            }
 34
 035            Name = name;
 036            PageCount = pageCount;
 037            Errors = errors.ToList();
 038            Status = status;
 039        }
 40
 41        /// <summary> Initializes a new instance of TrainingDocumentInfo. </summary>
 42        /// <param name="name"> Training document name. </param>
 43        /// <param name="pageCount"> Total number of pages trained. </param>
 44        /// <param name="errors"> List of errors. </param>
 45        /// <param name="status"> Status of the training operation. </param>
 136846        internal TrainingDocumentInfo(string name, int pageCount, IReadOnlyList<FormRecognizerError> errors, TrainingSta
 47        {
 136848            Name = name;
 136849            PageCount = pageCount;
 136850            Errors = errors;
 136851            Status = status;
 136852        }
 53        /// <summary> List of errors. </summary>
 92454        public IReadOnlyList<FormRecognizerError> Errors { get; }
 55        /// <summary> Status of the training operation. </summary>
 88456        public TrainingStatus Status { get; }
 57    }
 58}

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\TrainingDocumentInfo.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9using System.Text.Json;
 10using Azure.AI.FormRecognizer.Models;
 11using Azure.Core;
 12
 13namespace Azure.AI.FormRecognizer.Training
 14{
 15    public partial class TrainingDocumentInfo
 16    {
 17        internal static TrainingDocumentInfo DeserializeTrainingDocumentInfo(JsonElement element)
 18        {
 68419            string documentName = default;
 68420            int pages = default;
 68421            IReadOnlyList<FormRecognizerError> errors = default;
 68422            TrainingStatus status = default;
 616023            foreach (var property in element.EnumerateObject())
 24            {
 239625                if (property.NameEquals("documentName"))
 26                {
 68427                    documentName = property.Value.GetString();
 68428                    continue;
 29                }
 171230                if (property.NameEquals("pages"))
 31                {
 68432                    pages = property.Value.GetInt32();
 68433                    continue;
 34                }
 102835                if (property.NameEquals("errors"))
 36                {
 34437                    List<FormRecognizerError> array = new List<FormRecognizerError>();
 038                    foreach (var item in property.Value.EnumerateArray())
 39                    {
 040                        array.Add(FormRecognizerError.DeserializeFormRecognizerError(item));
 41                    }
 34442                    errors = array;
 34443                    continue;
 44                }
 68445                if (property.NameEquals("status"))
 46                {
 68447                    status = property.Value.GetString().ToTrainingStatus();
 48                    continue;
 49                }
 50            }
 68451            return new TrainingDocumentInfo(documentName, pages, errors, status);
 52        }
 53    }
 54}

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\TrainingDocumentInfo.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using Azure.Core;
 5
 6namespace Azure.AI.FormRecognizer.Training
 7{
 8    /// <summary>
 9    /// Represents a document that has been used to train a model.
 10    /// </summary>
 11    [CodeGenModel("TrainingDocumentInfo")]
 12    public partial class TrainingDocumentInfo
 13    {
 14        /// <summary>
 15        /// Training document name.
 16        /// </summary>
 17        [CodeGenMember("documentName")]
 42218        public string Name { get; }
 19
 20        /// <summary>
 21        /// The number of pages the document has.
 22        /// </summary>
 23        [CodeGenMember("pages")]
 42224        public int PageCount { get; }
 25    }
 26}