< Summary

Class:Azure.AI.TextAnalytics.ExtractKeyPhrasesResult
Assembly:Azure.AI.TextAnalytics
File(s):C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\ExtractKeyPhrasesResult.cs
Covered lines:7
Uncovered lines:0
Coverable lines:7
Total lines:40
Line coverage:100% (7 of 7)
Covered branches:2
Total branches:2
Branch coverage:100% (2 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
.ctor(...)-100%100%
get_KeyPhrases()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\ExtractKeyPhrasesResult.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5
 6namespace Azure.AI.TextAnalytics
 7{
 8    /// <summary>
 9    /// The result of the extract key phrases operation on a document.
 10    /// </summary>
 11    public class ExtractKeyPhrasesResult : TextAnalyticsResult
 12    {
 13        private readonly KeyPhraseCollection _keyPhrases;
 14
 15        internal ExtractKeyPhrasesResult(string id, TextDocumentStatistics statistics, KeyPhraseCollection keyPhrases)
 5216            : base(id, statistics)
 17        {
 5218            _keyPhrases = keyPhrases;
 5219        }
 20
 821        internal ExtractKeyPhrasesResult(string id, TextAnalyticsError error) : base(id, error) { }
 22
 23        /// <summary>
 24        /// Gets the collection of key phrases identified in the document.
 25        /// </summary>
 26        public KeyPhraseCollection KeyPhrases
 27        {
 28            get
 29            {
 4830                if (HasError)
 31                {
 32#pragma warning disable CA1065 // Do not raise exceptions in unexpected locations
 433                    throw new InvalidOperationException($"Cannot access result for document {Id}, due to error {Error.Er
 34#pragma warning restore CA1065 // Do not raise exceptions in unexpected locations
 35                }
 4436                return _keyPhrases;
 37            }
 38        }
 39    }
 40}