< Summary

Class:Azure.AI.TextAnalytics.Models.KeyPhraseResult
Assembly:Azure.AI.TextAnalytics
File(s):C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\KeyPhraseResult.cs
C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\KeyPhraseResult.Serialization.cs
Covered lines:0
Uncovered lines:44
Coverable lines:44
Total lines:124
Line coverage:0% (0 of 44)
Covered branches:0
Total branches:20
Branch coverage:0% (0 of 20)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%100%
get_Documents()-0%100%
get_Errors()-0%100%
get_Statistics()-0%100%
get_ModelVersion()-0%100%
DeserializeKeyPhraseResult(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\KeyPhraseResult.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 KeyPhraseResult. </summary>
 16    internal partial class KeyPhraseResult
 17    {
 18        /// <summary> Initializes a new instance of KeyPhraseResult. </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 KeyPhraseResult(IEnumerable<DocumentKeyPhrases> documents, IEnumerable<DocumentError> errors, string mo
 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 KeyPhraseResult. </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>
 048        internal KeyPhraseResult(IReadOnlyList<DocumentKeyPhrases> documents, IReadOnlyList<DocumentError> errors, TextD
 49        {
 050            Documents = documents;
 051            Errors = errors;
 052            Statistics = statistics;
 053            ModelVersion = modelVersion;
 054        }
 55
 56        /// <summary> Response by document. </summary>
 057        public IReadOnlyList<DocumentKeyPhrases> Documents { get; }
 58        /// <summary> Errors by document id. </summary>
 059        public IReadOnlyList<DocumentError> Errors { get; }
 60        /// <summary> if showStats=true was specified in the request this field will contain information about the reque
 061        public TextDocumentBatchStatistics Statistics { get; }
 62        /// <summary> This field indicates which model is used for scoring. </summary>
 063        public string ModelVersion { get; }
 64    }
 65}

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\KeyPhraseResult.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 KeyPhraseResult
 16    {
 17        internal static KeyPhraseResult DeserializeKeyPhraseResult(JsonElement element)
 18        {
 019            IReadOnlyList<DocumentKeyPhrases> documents = default;
 020            IReadOnlyList<DocumentError> errors = default;
 021            Optional<TextDocumentBatchStatistics> statistics = default;
 022            string modelVersion = default;
 023            foreach (var property in element.EnumerateObject())
 24            {
 025                if (property.NameEquals("documents"))
 26                {
 027                    List<DocumentKeyPhrases> array = new List<DocumentKeyPhrases>();
 028                    foreach (var item in property.Value.EnumerateArray())
 29                    {
 030                        array.Add(DocumentKeyPhrases.DeserializeDocumentKeyPhrases(item));
 31                    }
 032                    documents = array;
 033                    continue;
 34                }
 035                if (property.NameEquals("errors"))
 36                {
 037                    List<DocumentError> array = new List<DocumentError>();
 038                    foreach (var item in property.Value.EnumerateArray())
 39                    {
 040                        array.Add(DocumentError.DeserializeDocumentError(item));
 41                    }
 042                    errors = array;
 043                    continue;
 44                }
 045                if (property.NameEquals("statistics"))
 46                {
 047                    statistics = TextDocumentBatchStatistics.DeserializeTextDocumentBatchStatistics(property.Value);
 048                    continue;
 49                }
 050                if (property.NameEquals("modelVersion"))
 51                {
 052                    modelVersion = property.Value.GetString();
 53                    continue;
 54                }
 55            }
 056            return new KeyPhraseResult(documents, errors, statistics.Value, modelVersion);
 57        }
 58    }
 59}