< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
get_Sentiment()-0%100%
get_ConfidenceScores()-0%100%
get_Offset()-0%100%
get_Length()-0%100%
get_Text()-0%100%
get_IsNegated()-0%100%
DeserializeSentenceOpinion(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\SentenceOpinion.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;
 9
 10namespace Azure.AI.TextAnalytics.Models
 11{
 12    /// <summary> The SentenceOpinion. </summary>
 13    internal partial class SentenceOpinion
 14    {
 15        /// <summary> Initializes a new instance of SentenceOpinion. </summary>
 16        /// <param name="sentiment"> Opinion level sentiment for the aspect in the sentence. </param>
 17        /// <param name="confidenceScores"> Opinion level sentiment confidence scores for the aspect in the sentence. </
 18        /// <param name="offset"> The opinion offset from the start of the sentence. </param>
 19        /// <param name="length"> The length of the opinion. </param>
 20        /// <param name="text"> The aspect text detected. </param>
 21        /// <param name="isNegated"> The indicator representing if the opinion is negated. </param>
 22        /// <exception cref="ArgumentNullException"> <paramref name="confidenceScores"/> or <paramref name="text"/> is n
 023        internal SentenceOpinion(SentenceOpinionSentiment sentiment, AspectConfidenceScoreLabel confidenceScores, int of
 24        {
 025            if (confidenceScores == null)
 26            {
 027                throw new ArgumentNullException(nameof(confidenceScores));
 28            }
 029            if (text == null)
 30            {
 031                throw new ArgumentNullException(nameof(text));
 32            }
 33
 034            Sentiment = sentiment;
 035            ConfidenceScores = confidenceScores;
 036            Offset = offset;
 037            Length = length;
 038            Text = text;
 039            IsNegated = isNegated;
 040        }
 41
 42        /// <summary> Opinion level sentiment for the aspect in the sentence. </summary>
 043        public SentenceOpinionSentiment Sentiment { get; }
 44        /// <summary> Opinion level sentiment confidence scores for the aspect in the sentence. </summary>
 045        public AspectConfidenceScoreLabel ConfidenceScores { get; }
 46        /// <summary> The opinion offset from the start of the sentence. </summary>
 047        public int Offset { get; }
 48        /// <summary> The length of the opinion. </summary>
 049        public int Length { get; }
 50        /// <summary> The aspect text detected. </summary>
 051        public string Text { get; }
 52        /// <summary> The indicator representing if the opinion is negated. </summary>
 053        public bool IsNegated { get; }
 54    }
 55}

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\SentenceOpinion.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.Text.Json;
 9using Azure.Core;
 10
 11namespace Azure.AI.TextAnalytics.Models
 12{
 13    internal partial class SentenceOpinion
 14    {
 15        internal static SentenceOpinion DeserializeSentenceOpinion(JsonElement element)
 16        {
 017            SentenceOpinionSentiment sentiment = default;
 018            AspectConfidenceScoreLabel confidenceScores = default;
 019            int offset = default;
 020            int length = default;
 021            string text = default;
 022            bool isNegated = default;
 023            foreach (var property in element.EnumerateObject())
 24            {
 025                if (property.NameEquals("sentiment"))
 26                {
 027                    sentiment = new SentenceOpinionSentiment(property.Value.GetString());
 028                    continue;
 29                }
 030                if (property.NameEquals("confidenceScores"))
 31                {
 032                    confidenceScores = AspectConfidenceScoreLabel.DeserializeAspectConfidenceScoreLabel(property.Value);
 033                    continue;
 34                }
 035                if (property.NameEquals("offset"))
 36                {
 037                    offset = property.Value.GetInt32();
 038                    continue;
 39                }
 040                if (property.NameEquals("length"))
 41                {
 042                    length = property.Value.GetInt32();
 043                    continue;
 44                }
 045                if (property.NameEquals("text"))
 46                {
 047                    text = property.Value.GetString();
 048                    continue;
 49                }
 050                if (property.NameEquals("isNegated"))
 51                {
 052                    isNegated = property.Value.GetBoolean();
 53                    continue;
 54                }
 55            }
 056            return new SentenceOpinion(sentiment, confidenceScores, offset, length, text, isNegated);
 57        }
 58    }
 59}