< Summary

Class:Azure.AI.FormRecognizer.Models.FieldValue_internal
Assembly:Azure.AI.FormRecognizer
File(s):C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\FieldValue_internal.cs
C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\FieldValue_internal.cs
C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\FieldValue_internal.Serialization.cs
Covered lines:100
Uncovered lines:12
Coverable lines:112
Total lines:238
Line coverage:89.2% (100 of 112)
Covered branches:37
Total branches:38
Branch coverage:97.3% (37 of 38)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_Type()-100%100%
get_ValueString()-100%100%
get_ValueDate()-100%100%
get_ValueTime()-100%100%
get_ValuePhoneNumber()-100%100%
get_ValueNumber()-100%100%
get_ValueArray()-100%100%
get_ValueObject()-100%100%
get_Text()-100%100%
get_BoundingBox()-100%100%
get_Confidence()-100%100%
get_Elements()-100%100%
get_Page()-100%100%
.ctor(...)-100%100%
get_ValueInteger()-0%100%
.ctor(...)-100%100%
.ctor(...)-50%100%
.ctor(...)-0%100%
.ctor(...)-100%100%
get_Type()-100%100%
get_ValueString()-100%100%
get_ValueDate()-100%100%
get_ValueTime()-100%100%
get_ValuePhoneNumber()-0%100%
get_ValueNumber()-100%100%
get_ValueArray()-100%100%
get_ValueObject()-100%100%
get_Text()-100%100%
get_BoundingBox()-100%100%
get_Confidence()-100%100%
get_Elements()-100%100%
get_Page()-100%100%
DeserializeFieldValue_internal(...)-97.1%97.37%

File(s)

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\FieldValue_internal.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.Models
 7{
 8    [CodeGenModel("FieldValue")]
 9    internal partial class FieldValue_internal
 10    {
 11        /// <summary>Integer value.</summary>
 012        public long? ValueInteger { get; }
 13
 57614        internal FieldValue_internal(string value)
 15        {
 57616            Type = FieldValueType.String;
 57617            ValueString = value;
 57618            Text = value;
 57619        }
 20    }
 021}

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\FieldValue_internal.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 Azure.Core;
 11
 12namespace Azure.AI.FormRecognizer.Models
 13{
 14    /// <summary> Recognized field value. </summary>
 15    internal partial class FieldValue_internal
 16    {
 17        /// <summary> Initializes a new instance of FieldValue_internal. </summary>
 18        /// <param name="type"> Type of field value. </param>
 019        internal FieldValue_internal(FieldValueType type)
 20        {
 021            Type = type;
 022            ValueArray = new ChangeTrackingList<FieldValue_internal>();
 023            ValueObject = new ChangeTrackingDictionary<string, FieldValue_internal>();
 024            BoundingBox = new ChangeTrackingList<float>();
 025            Elements = new ChangeTrackingList<string>();
 026        }
 27
 28        /// <summary> Initializes a new instance of FieldValue_internal. </summary>
 29        /// <param name="type"> Type of field value. </param>
 30        /// <param name="valueString"> String value. </param>
 31        /// <param name="valueDate"> Date value. </param>
 32        /// <param name="valueTime"> Time value. </param>
 33        /// <param name="valuePhoneNumber"> Phone number value. </param>
 34        /// <param name="valueNumber"> Floating point value. </param>
 35        /// <param name="valueInteger"> Integer value. </param>
 36        /// <param name="valueArray"> Array of field values. </param>
 37        /// <param name="valueObject"> Dictionary of named field values. </param>
 38        /// <param name="text"> Text content of the extracted field. </param>
 39        /// <param name="boundingBox"> Bounding box of the field value, if appropriate. </param>
 40        /// <param name="confidence"> Confidence score. </param>
 41        /// <param name="elements"> When includeTextDetails is set to true, a list of references to the text elements co
 42        /// <param name="page"> The 1-based page number in the input document. </param>
 39843        internal FieldValue_internal(FieldValueType type, string valueString, DateTimeOffset? valueDate, TimeSpan? value
 44        {
 39845            Type = type;
 39846            ValueString = valueString;
 39847            ValueDate = valueDate;
 39848            ValueTime = valueTime;
 39849            ValuePhoneNumber = valuePhoneNumber;
 39850            ValueNumber = valueNumber;
 39851            ValueInteger = valueInteger;
 39852            ValueArray = valueArray;
 39853            ValueObject = valueObject;
 39854            Text = text;
 39855            BoundingBox = boundingBox;
 39856            Confidence = confidence;
 39857            Elements = elements;
 39858            Page = page;
 39859        }
 60
 61        /// <summary> Type of field value. </summary>
 65662        public FieldValueType Type { get; }
 63        /// <summary> String value. </summary>
 5664        public string ValueString { get; }
 65        /// <summary> Date value. </summary>
 1666        public DateTimeOffset? ValueDate { get; }
 67        /// <summary> Time value. </summary>
 1668        public TimeSpan? ValueTime { get; }
 69        /// <summary> Phone number value. </summary>
 070        public string ValuePhoneNumber { get; }
 71        /// <summary> Floating point value. </summary>
 9672        public float? ValueNumber { get; }
 73        /// <summary> Array of field values. </summary>
 874        public IReadOnlyList<FieldValue_internal> ValueArray { get; }
 75        /// <summary> Dictionary of named field values. </summary>
 1676        public IReadOnlyDictionary<string, FieldValue_internal> ValueObject { get; }
 77        /// <summary> Text content of the extracted field. </summary>
 38478        public string Text { get; }
 79        /// <summary> Bounding box of the field value, if appropriate. </summary>
 68880        public IReadOnlyList<float> BoundingBox { get; }
 81        /// <summary> Confidence score. </summary>
 36882        public float? Confidence { get; }
 83        /// <summary> When includeTextDetails is set to true, a list of references to the text elements constituting thi
 32084        public IReadOnlyList<string> Elements { get; }
 85        /// <summary> The 1-based page number in the input document. </summary>
 36886        public int? Page { get; }
 87    }
 88}

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\FieldValue_internal.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;
 9using System.Collections.Generic;
 10using System.Text.Json;
 11using Azure.Core;
 12
 13namespace Azure.AI.FormRecognizer.Models
 14{
 15    internal partial class FieldValue_internal
 16    {
 17        internal static FieldValue_internal DeserializeFieldValue_internal(JsonElement element)
 18        {
 79619            FieldValueType type = default;
 79620            Optional<string> valueString = default;
 79621            Optional<DateTimeOffset> valueDate = default;
 79622            Optional<TimeSpan> valueTime = default;
 79623            Optional<string> valuePhoneNumber = default;
 79624            Optional<float> valueNumber = default;
 79625            Optional<long> valueInteger = default;
 79626            Optional<IReadOnlyList<FieldValue_internal>> valueArray = default;
 79627            Optional<IReadOnlyDictionary<string, FieldValue_internal>> valueObject = default;
 79628            Optional<string> text = default;
 79629            Optional<IReadOnlyList<float>> boundingBox = default;
 79630            Optional<float> confidence = default;
 79631            Optional<IReadOnlyList<string>> elements = default;
 79632            Optional<int> page = default;
 1080033            foreach (var property in element.EnumerateObject())
 34            {
 460435                if (property.NameEquals("type"))
 36                {
 79637                    type = property.Value.GetString().ToFieldValueType();
 79638                    continue;
 39                }
 380840                if (property.NameEquals("valueString"))
 41                {
 49642                    valueString = property.Value.GetString();
 49643                    continue;
 44                }
 331245                if (property.NameEquals("valueDate"))
 46                {
 1647                    valueDate = property.Value.GetDateTimeOffset("D");
 1648                    continue;
 49                }
 329650                if (property.NameEquals("valueTime"))
 51                {
 1652                    valueTime = property.Value.GetTimeSpan("T");
 1653                    continue;
 54                }
 328055                if (property.NameEquals("valuePhoneNumber"))
 56                {
 1657                    valuePhoneNumber = property.Value.GetString();
 1658                    continue;
 59                }
 326460                if (property.NameEquals("valueNumber"))
 61                {
 11662                    valueNumber = property.Value.GetSingle();
 11663                    continue;
 64                }
 314865                if (property.NameEquals("valueInteger"))
 66                {
 067                    valueInteger = property.Value.GetInt64();
 068                    continue;
 69                }
 314870                if (property.NameEquals("valueArray"))
 71                {
 2472                    List<FieldValue_internal> array = new List<FieldValue_internal>();
 15273                    foreach (var item in property.Value.EnumerateArray())
 74                    {
 5275                        array.Add(DeserializeFieldValue_internal(item));
 76                    }
 2477                    valueArray = array;
 2478                    continue;
 79                }
 312480                if (property.NameEquals("valueObject"))
 81                {
 5282                    Dictionary<string, FieldValue_internal> dictionary = new Dictionary<string, FieldValue_internal>();
 36083                    foreach (var property0 in property.Value.EnumerateObject())
 84                    {
 12885                        dictionary.Add(property0.Name, DeserializeFieldValue_internal(property0.Value));
 86                    }
 5287                    valueObject = dictionary;
 5288                    continue;
 89                }
 307290                if (property.NameEquals("text"))
 91                {
 68092                    text = property.Value.GetString();
 68093                    continue;
 94                }
 239295                if (property.NameEquals("boundingBox"))
 96                {
 68097                    List<float> array = new List<float>();
 1224098                    foreach (var item in property.Value.EnumerateArray())
 99                    {
 5440100                        array.Add(item.GetSingle());
 101                    }
 680102                    boundingBox = array;
 680103                    continue;
 104                }
 1712105                if (property.NameEquals("confidence"))
 106                {
 720107                    confidence = property.Value.GetSingle();
 720108                    continue;
 109                }
 992110                if (property.NameEquals("elements"))
 111                {
 312112                    List<string> array = new List<string>();
 1760113                    foreach (var item in property.Value.EnumerateArray())
 114                    {
 568115                        array.Add(item.GetString());
 116                    }
 312117                    elements = array;
 312118                    continue;
 119                }
 680120                if (property.NameEquals("page"))
 121                {
 680122                    page = property.Value.GetInt32();
 123                    continue;
 124                }
 125            }
 796126            return new FieldValue_internal(type, valueString.Value, Optional.ToNullable(valueDate), Optional.ToNullable(
 127        }
 128    }
 129}