< Summary

Class:Azure.AI.FormRecognizer.Models.DocumentResult
Assembly:Azure.AI.FormRecognizer
File(s):C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\DocumentResult.cs
C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\DocumentResult.Serialization.cs
Covered lines:29
Uncovered lines:11
Coverable lines:40
Total lines:119
Line coverage:72.5% (29 of 40)
Covered branches:14
Total branches:20
Branch coverage:70% (14 of 20)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%100%
get_DocType()-100%100%
get_PageRange()-100%100%
get_Fields()-100%100%
DeserializeDocumentResult(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\DocumentResult.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;
 11
 12namespace Azure.AI.FormRecognizer.Models
 13{
 14    /// <summary> A set of extracted fields corresponding to the input document. </summary>
 15    internal partial class DocumentResult
 16    {
 17        /// <summary> Initializes a new instance of DocumentResult. </summary>
 18        /// <param name="docType"> Document type. </param>
 19        /// <param name="pageRange"> First and last page number where the document is found. </param>
 20        /// <param name="fields"> Dictionary of named field values. </param>
 21        /// <exception cref="ArgumentNullException"> <paramref name="docType"/>, <paramref name="pageRange"/>, or <param
 022        internal DocumentResult(string docType, IEnumerable<int> pageRange, IReadOnlyDictionary<string, FieldValue_inter
 23        {
 024            if (docType == null)
 25            {
 026                throw new ArgumentNullException(nameof(docType));
 27            }
 028            if (pageRange == null)
 29            {
 030                throw new ArgumentNullException(nameof(pageRange));
 31            }
 032            if (fields == null)
 33            {
 034                throw new ArgumentNullException(nameof(fields));
 35            }
 36
 037            DocType = docType;
 038            PageRange = pageRange.ToList();
 039            Fields = fields;
 040        }
 41
 42        /// <summary> Initializes a new instance of DocumentResult. </summary>
 43        /// <param name="docType"> Document type. </param>
 44        /// <param name="pageRange"> First and last page number where the document is found. </param>
 45        /// <param name="fields"> Dictionary of named field values. </param>
 9246        internal DocumentResult(string docType, IReadOnlyList<int> pageRange, IReadOnlyDictionary<string, FieldValue_int
 47        {
 9248            DocType = docType;
 9249            PageRange = pageRange;
 9250            Fields = fields;
 9251        }
 52
 53        /// <summary> Document type. </summary>
 9254        public string DocType { get; }
 55        /// <summary> First and last page number where the document is found. </summary>
 18456        public IReadOnlyList<int> PageRange { get; }
 57        /// <summary> Dictionary of named field values. </summary>
 18458        public IReadOnlyDictionary<string, FieldValue_internal> Fields { get; }
 59    }
 60}

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\DocumentResult.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.Core;
 11
 12namespace Azure.AI.FormRecognizer.Models
 13{
 14    internal partial class DocumentResult
 15    {
 16        internal static DocumentResult DeserializeDocumentResult(JsonElement element)
 17        {
 9218            string docType = default;
 9219            IReadOnlyList<int> pageRange = default;
 9220            IReadOnlyDictionary<string, FieldValue_internal> fields = default;
 73621            foreach (var property in element.EnumerateObject())
 22            {
 27623                if (property.NameEquals("docType"))
 24                {
 9225                    docType = property.Value.GetString();
 9226                    continue;
 27                }
 18428                if (property.NameEquals("pageRange"))
 29                {
 9230                    List<int> array = new List<int>();
 55231                    foreach (var item in property.Value.EnumerateArray())
 32                    {
 18433                        array.Add(item.GetInt32());
 34                    }
 9235                    pageRange = array;
 9236                    continue;
 37                }
 9238                if (property.NameEquals("fields"))
 39                {
 9240                    Dictionary<string, FieldValue_internal> dictionary = new Dictionary<string, FieldValue_internal>();
 175241                    foreach (var property0 in property.Value.EnumerateObject())
 42                    {
 78443                        if (property0.Value.ValueKind == JsonValueKind.Null)
 44                        {
 16845                            dictionary.Add(property0.Name, null);
 46                        }
 47                        else
 48                        {
 61649                            dictionary.Add(property0.Name, FieldValue_internal.DeserializeFieldValue_internal(property0.
 50                        }
 51                    }
 9252                    fields = dictionary;
 53                    continue;
 54                }
 55            }
 9256            return new DocumentResult(docType, pageRange, fields);
 57        }
 58    }
 59}