< Summary

Class:Azure.AI.TextAnalytics.Models.DocumentLanguage
Assembly:Azure.AI.TextAnalytics
File(s):C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\DocumentLanguage.cs
C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\DocumentLanguage.Serialization.cs
Covered lines:28
Uncovered lines:11
Coverable lines:39
Total lines:115
Line coverage:71.7% (28 of 39)
Covered branches:11
Total branches:16
Branch coverage:68.7% (11 of 16)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%100%
get_Id()-100%100%
get_DetectedLanguage()-100%100%
get_Warnings()-100%100%
get_Statistics()-100%100%
DeserializeDocumentLanguage(...)-90%91.67%

File(s)

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\DocumentLanguage.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.TextAnalytics;
 12
 13namespace Azure.AI.TextAnalytics.Models
 14{
 15    /// <summary> The DocumentLanguage. </summary>
 16    internal partial class DocumentLanguage
 17    {
 18        /// <summary> Initializes a new instance of DocumentLanguage. </summary>
 19        /// <param name="id"> Unique, non-empty document identifier. </param>
 20        /// <param name="detectedLanguage"> Detected Language. </param>
 21        /// <param name="warnings"> Warnings encountered while processing document. </param>
 22        /// <exception cref="ArgumentNullException"> <paramref name="id"/> or <paramref name="warnings"/> is null. </exc
 023        internal DocumentLanguage(string id, DetectedLanguage_internal detectedLanguage, IEnumerable<TextAnalyticsWarnin
 24        {
 025            if (id == null)
 26            {
 027                throw new ArgumentNullException(nameof(id));
 28            }
 029            if (warnings == null)
 30            {
 031                throw new ArgumentNullException(nameof(warnings));
 32            }
 33
 034            Id = id;
 035            DetectedLanguage = detectedLanguage;
 036            Warnings = warnings.ToList();
 037        }
 38
 39        /// <summary> Initializes a new instance of DocumentLanguage. </summary>
 40        /// <param name="id"> Unique, non-empty document identifier. </param>
 41        /// <param name="detectedLanguage"> Detected Language. </param>
 42        /// <param name="warnings"> Warnings encountered while processing document. </param>
 43        /// <param name="statistics"> if showStats=true was specified in the request this field will contain information
 8444        internal DocumentLanguage(string id, DetectedLanguage_internal detectedLanguage, IReadOnlyList<TextAnalyticsWarn
 45        {
 8446            Id = id;
 8447            DetectedLanguage = detectedLanguage;
 8448            Warnings = warnings;
 8449            Statistics = statistics;
 8450        }
 51
 52        /// <summary> Unique, non-empty document identifier. </summary>
 6053        public string Id { get; }
 54        /// <summary> Detected Language. </summary>
 8455        public DetectedLanguage_internal DetectedLanguage { get; }
 56        /// <summary> Warnings encountered while processing document. </summary>
 8457        public IReadOnlyList<TextAnalyticsWarning_internal> Warnings { get; }
 58        /// <summary> if showStats=true was specified in the request this field will contain information about the docum
 6059        public TextDocumentStatistics? Statistics { get; }
 60    }
 61}

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\DocumentLanguage.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.TextAnalytics;
 11using Azure.Core;
 12
 13namespace Azure.AI.TextAnalytics.Models
 14{
 15    internal partial class DocumentLanguage
 16    {
 17        internal static DocumentLanguage DeserializeDocumentLanguage(JsonElement element)
 18        {
 8419            string id = default;
 8420            DetectedLanguage_internal detectedLanguage = default;
 8421            IReadOnlyList<TextAnalyticsWarning_internal> warnings = default;
 8422            Optional<TextDocumentStatistics> statistics = default;
 72023            foreach (var property in element.EnumerateObject())
 24            {
 27625                if (property.NameEquals("id"))
 26                {
 8427                    id = property.Value.GetString();
 8428                    continue;
 29                }
 19230                if (property.NameEquals("detectedLanguage"))
 31                {
 8432                    detectedLanguage = DetectedLanguage_internal.DeserializeDetectedLanguage_internal(property.Value);
 8433                    continue;
 34                }
 10835                if (property.NameEquals("warnings"))
 36                {
 8437                    List<TextAnalyticsWarning_internal> array = new List<TextAnalyticsWarning_internal>();
 038                    foreach (var item in property.Value.EnumerateArray())
 39                    {
 040                        array.Add(TextAnalyticsWarning_internal.DeserializeTextAnalyticsWarning_internal(item));
 41                    }
 8442                    warnings = array;
 8443                    continue;
 44                }
 2445                if (property.NameEquals("statistics"))
 46                {
 2447                    statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value);
 48                    continue;
 49                }
 50            }
 8451            return new DocumentLanguage(id, detectedLanguage, warnings, Optional.ToNullable(statistics));
 52        }
 53    }
 54}