< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%100%
get_Id()-0%100%
get_Sentiment()-0%100%
get_Statistics()-0%100%
get_ConfidenceScores()-0%100%
get_Sentences()-0%100%
get_Warnings()-0%100%
DeserializeDocumentSentiment(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\DocumentSentiment.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 DocumentSentiment. </summary>
 16    internal partial class DocumentSentiment
 17    {
 18        /// <summary> Initializes a new instance of DocumentSentiment. </summary>
 19        /// <param name="id"> Unique, non-empty document identifier. </param>
 20        /// <param name="sentiment"> Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). </param>
 21        /// <param name="confidenceScores"> Document level sentiment confidence scores between 0 and 1 for each sentimen
 22        /// <param name="sentences"> Sentence level sentiment analysis. </param>
 23        /// <param name="warnings"> Warnings encountered while processing document. </param>
 24        /// <exception cref="ArgumentNullException"> <paramref name="id"/>, <paramref name="confidenceScores"/>, <paramr
 025        internal DocumentSentiment(string id, DocumentSentimentValue sentiment, SentimentConfidenceScorePerLabel confide
 26        {
 027            if (id == null)
 28            {
 029                throw new ArgumentNullException(nameof(id));
 30            }
 031            if (confidenceScores == null)
 32            {
 033                throw new ArgumentNullException(nameof(confidenceScores));
 34            }
 035            if (sentences == null)
 36            {
 037                throw new ArgumentNullException(nameof(sentences));
 38            }
 039            if (warnings == null)
 40            {
 041                throw new ArgumentNullException(nameof(warnings));
 42            }
 43
 044            Id = id;
 045            Sentiment = sentiment;
 046            ConfidenceScores = confidenceScores;
 047            Sentences = sentences.ToList();
 048            Warnings = warnings.ToList();
 049        }
 50
 51        /// <summary> Initializes a new instance of DocumentSentiment. </summary>
 52        /// <param name="id"> Unique, non-empty document identifier. </param>
 53        /// <param name="sentiment"> Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). </param>
 54        /// <param name="statistics"> if showStats=true was specified in the request this field will contain information
 55        /// <param name="confidenceScores"> Document level sentiment confidence scores between 0 and 1 for each sentimen
 56        /// <param name="sentences"> Sentence level sentiment analysis. </param>
 57        /// <param name="warnings"> Warnings encountered while processing document. </param>
 058        internal DocumentSentiment(string id, DocumentSentimentValue sentiment, TextDocumentStatistics? statistics, Sent
 59        {
 060            Id = id;
 061            Sentiment = sentiment;
 062            Statistics = statistics;
 063            ConfidenceScores = confidenceScores;
 064            Sentences = sentences;
 065            Warnings = warnings;
 066        }
 67
 68        /// <summary> Unique, non-empty document identifier. </summary>
 069        public string Id { get; }
 70        /// <summary> Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). </summary>
 071        public DocumentSentimentValue Sentiment { get; }
 72        /// <summary> if showStats=true was specified in the request this field will contain information about the docum
 073        public TextDocumentStatistics? Statistics { get; }
 74        /// <summary> Document level sentiment confidence scores between 0 and 1 for each sentiment class. </summary>
 075        public SentimentConfidenceScorePerLabel ConfidenceScores { get; }
 76        /// <summary> Sentence level sentiment analysis. </summary>
 077        public IReadOnlyList<SentenceSentiment> Sentences { get; }
 78        /// <summary> Warnings encountered while processing document. </summary>
 079        public IReadOnlyList<TextAnalyticsWarning_internal> Warnings { get; }
 80    }
 81}

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\DocumentSentiment.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 DocumentSentiment
 16    {
 17        internal static DocumentSentiment DeserializeDocumentSentiment(JsonElement element)
 18        {
 019            string id = default;
 020            DocumentSentimentValue sentiment = default;
 021            Optional<TextDocumentStatistics> statistics = default;
 022            SentimentConfidenceScorePerLabel confidenceScores = default;
 023            IReadOnlyList<SentenceSentiment> sentences = default;
 024            IReadOnlyList<TextAnalyticsWarning_internal> warnings = default;
 025            foreach (var property in element.EnumerateObject())
 26            {
 027                if (property.NameEquals("id"))
 28                {
 029                    id = property.Value.GetString();
 030                    continue;
 31                }
 032                if (property.NameEquals("sentiment"))
 33                {
 034                    sentiment = property.Value.GetString().ToDocumentSentimentValue();
 035                    continue;
 36                }
 037                if (property.NameEquals("statistics"))
 38                {
 039                    statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value);
 040                    continue;
 41                }
 042                if (property.NameEquals("confidenceScores"))
 43                {
 044                    confidenceScores = SentimentConfidenceScorePerLabel.DeserializeSentimentConfidenceScorePerLabel(prop
 045                    continue;
 46                }
 047                if (property.NameEquals("sentences"))
 48                {
 049                    List<SentenceSentiment> array = new List<SentenceSentiment>();
 050                    foreach (var item in property.Value.EnumerateArray())
 51                    {
 052                        array.Add(SentenceSentiment.DeserializeSentenceSentiment(item));
 53                    }
 054                    sentences = array;
 055                    continue;
 56                }
 057                if (property.NameEquals("warnings"))
 58                {
 059                    List<TextAnalyticsWarning_internal> array = new List<TextAnalyticsWarning_internal>();
 060                    foreach (var item in property.Value.EnumerateArray())
 61                    {
 062                        array.Add(TextAnalyticsWarning_internal.DeserializeTextAnalyticsWarning_internal(item));
 63                    }
 064                    warnings = array;
 65                    continue;
 66                }
 67            }
 068            return new DocumentSentiment(id, sentiment, Optional.ToNullable(statistics), confidenceScores, sentences, wa
 69        }
 70    }
 71}