< Summary

Class:Azure.AI.TextAnalytics.Models.LanguageResult
Assembly:Azure.AI.TextAnalytics
File(s):C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\LanguageResult.cs
C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\LanguageResult.Serialization.cs
Covered lines:33
Uncovered lines:11
Coverable lines:44
Total lines:124
Line coverage:75% (33 of 44)
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_Documents()-100%100%
get_Errors()-100%100%
get_Statistics()-100%100%
get_ModelVersion()-100%100%
DeserializeLanguageResult(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\LanguageResult.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 LanguageResult. </summary>
 16    internal partial class LanguageResult
 17    {
 18        /// <summary> Initializes a new instance of LanguageResult. </summary>
 19        /// <param name="documents"> Response by document. </param>
 20        /// <param name="errors"> Errors by document id. </param>
 21        /// <param name="modelVersion"> This field indicates which model is used for scoring. </param>
 22        /// <exception cref="ArgumentNullException"> <paramref name="documents"/>, <paramref name="errors"/>, or <paramr
 023        internal LanguageResult(IEnumerable<DocumentLanguage> documents, IEnumerable<DocumentError> errors, string model
 24        {
 025            if (documents == null)
 26            {
 027                throw new ArgumentNullException(nameof(documents));
 28            }
 029            if (errors == null)
 30            {
 031                throw new ArgumentNullException(nameof(errors));
 32            }
 033            if (modelVersion == null)
 34            {
 035                throw new ArgumentNullException(nameof(modelVersion));
 36            }
 37
 038            Documents = documents.ToList();
 039            Errors = errors.ToList();
 040            ModelVersion = modelVersion;
 041        }
 42
 43        /// <summary> Initializes a new instance of LanguageResult. </summary>
 44        /// <param name="documents"> Response by document. </param>
 45        /// <param name="errors"> Errors by document id. </param>
 46        /// <param name="statistics"> if showStats=true was specified in the request this field will contain information
 47        /// <param name="modelVersion"> This field indicates which model is used for scoring. </param>
 4848        internal LanguageResult(IReadOnlyList<DocumentLanguage> documents, IReadOnlyList<DocumentError> errors, TextDocu
 49        {
 4850            Documents = documents;
 4851            Errors = errors;
 4852            Statistics = statistics;
 4853            ModelVersion = modelVersion;
 4854        }
 55
 56        /// <summary> Response by document. </summary>
 4457        public IReadOnlyList<DocumentLanguage> Documents { get; }
 58        /// <summary> Errors by document id. </summary>
 5259        public IReadOnlyList<DocumentError> Errors { get; }
 60        /// <summary> if showStats=true was specified in the request this field will contain information about the reque
 2061        public TextDocumentBatchStatistics Statistics { get; }
 62        /// <summary> This field indicates which model is used for scoring. </summary>
 2063        public string ModelVersion { get; }
 64    }
 65}

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\LanguageResult.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 LanguageResult
 16    {
 17        internal static LanguageResult DeserializeLanguageResult(JsonElement element)
 18        {
 4819            IReadOnlyList<DocumentLanguage> documents = default;
 4820            IReadOnlyList<DocumentError> errors = default;
 4821            Optional<TextDocumentBatchStatistics> statistics = default;
 4822            string modelVersion = default;
 40023            foreach (var property in element.EnumerateObject())
 24            {
 15225                if (property.NameEquals("documents"))
 26                {
 4827                    List<DocumentLanguage> array = new List<DocumentLanguage>();
 26428                    foreach (var item in property.Value.EnumerateArray())
 29                    {
 8430                        array.Add(DocumentLanguage.DeserializeDocumentLanguage(item));
 31                    }
 4832                    documents = array;
 4833                    continue;
 34                }
 10435                if (property.NameEquals("errors"))
 36                {
 4837                    List<DocumentError> array = new List<DocumentError>();
 11238                    foreach (var item in property.Value.EnumerateArray())
 39                    {
 840                        array.Add(DocumentError.DeserializeDocumentError(item));
 41                    }
 4842                    errors = array;
 4843                    continue;
 44                }
 5645                if (property.NameEquals("statistics"))
 46                {
 847                    statistics = TextDocumentBatchStatistics.DeserializeTextDocumentBatchStatistics(property.Value);
 848                    continue;
 49                }
 4850                if (property.NameEquals("modelVersion"))
 51                {
 4852                    modelVersion = property.Value.GetString();
 53                    continue;
 54                }
 55            }
 4856            return new LanguageResult(documents, errors, statistics.Value, modelVersion);
 57        }
 58    }
 59}