< Summary

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

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\SentenceAspect.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;
 11
 12namespace Azure.AI.TextAnalytics.Models
 13{
 14    /// <summary> The SentenceAspect. </summary>
 15    internal partial class SentenceAspect
 16    {
 17        /// <summary> Initializes a new instance of SentenceAspect. </summary>
 18        /// <param name="sentiment"> Aspect level sentiment for the aspect in the sentence. </param>
 19        /// <param name="confidenceScores"> Aspect level sentiment confidence scores for the aspect in the sentence. </p
 20        /// <param name="offset"> The aspect offset from the start of the sentence. </param>
 21        /// <param name="length"> The length of the aspect. </param>
 22        /// <param name="text"> The aspect text detected. </param>
 23        /// <param name="relations"> The array of either opinion or aspect object which is related to the aspect. </para
 24        /// <exception cref="ArgumentNullException"> <paramref name="confidenceScores"/>, <paramref name="text"/>, or <p
 025        internal SentenceAspect(SentenceAspectSentiment sentiment, AspectConfidenceScoreLabel confidenceScores, int offs
 26        {
 027            if (confidenceScores == null)
 28            {
 029                throw new ArgumentNullException(nameof(confidenceScores));
 30            }
 031            if (text == null)
 32            {
 033                throw new ArgumentNullException(nameof(text));
 34            }
 035            if (relations == null)
 36            {
 037                throw new ArgumentNullException(nameof(relations));
 38            }
 39
 040            Sentiment = sentiment;
 041            ConfidenceScores = confidenceScores;
 042            Offset = offset;
 043            Length = length;
 044            Text = text;
 045            Relations = relations.ToList();
 046        }
 47
 48        /// <summary> Initializes a new instance of SentenceAspect. </summary>
 49        /// <param name="sentiment"> Aspect level sentiment for the aspect in the sentence. </param>
 50        /// <param name="confidenceScores"> Aspect level sentiment confidence scores for the aspect in the sentence. </p
 51        /// <param name="offset"> The aspect offset from the start of the sentence. </param>
 52        /// <param name="length"> The length of the aspect. </param>
 53        /// <param name="text"> The aspect text detected. </param>
 54        /// <param name="relations"> The array of either opinion or aspect object which is related to the aspect. </para
 055        internal SentenceAspect(SentenceAspectSentiment sentiment, AspectConfidenceScoreLabel confidenceScores, int offs
 56        {
 057            Sentiment = sentiment;
 058            ConfidenceScores = confidenceScores;
 059            Offset = offset;
 060            Length = length;
 061            Text = text;
 062            Relations = relations;
 063        }
 64
 65        /// <summary> Aspect level sentiment for the aspect in the sentence. </summary>
 066        public SentenceAspectSentiment Sentiment { get; }
 67        /// <summary> Aspect level sentiment confidence scores for the aspect in the sentence. </summary>
 068        public AspectConfidenceScoreLabel ConfidenceScores { get; }
 69        /// <summary> The aspect offset from the start of the sentence. </summary>
 070        public int Offset { get; }
 71        /// <summary> The length of the aspect. </summary>
 072        public int Length { get; }
 73        /// <summary> The aspect text detected. </summary>
 074        public string Text { get; }
 75        /// <summary> The array of either opinion or aspect object which is related to the aspect. </summary>
 076        public IReadOnlyList<AspectRelation> Relations { get; }
 77    }
 78}

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\Generated\Models\SentenceAspect.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.Core;
 11
 12namespace Azure.AI.TextAnalytics.Models
 13{
 14    internal partial class SentenceAspect
 15    {
 16        internal static SentenceAspect DeserializeSentenceAspect(JsonElement element)
 17        {
 018            SentenceAspectSentiment sentiment = default;
 019            AspectConfidenceScoreLabel confidenceScores = default;
 020            int offset = default;
 021            int length = default;
 022            string text = default;
 023            IReadOnlyList<AspectRelation> relations = default;
 024            foreach (var property in element.EnumerateObject())
 25            {
 026                if (property.NameEquals("sentiment"))
 27                {
 028                    sentiment = new SentenceAspectSentiment(property.Value.GetString());
 029                    continue;
 30                }
 031                if (property.NameEquals("confidenceScores"))
 32                {
 033                    confidenceScores = AspectConfidenceScoreLabel.DeserializeAspectConfidenceScoreLabel(property.Value);
 034                    continue;
 35                }
 036                if (property.NameEquals("offset"))
 37                {
 038                    offset = property.Value.GetInt32();
 039                    continue;
 40                }
 041                if (property.NameEquals("length"))
 42                {
 043                    length = property.Value.GetInt32();
 044                    continue;
 45                }
 046                if (property.NameEquals("text"))
 47                {
 048                    text = property.Value.GetString();
 049                    continue;
 50                }
 051                if (property.NameEquals("relations"))
 52                {
 053                    List<AspectRelation> array = new List<AspectRelation>();
 054                    foreach (var item in property.Value.EnumerateArray())
 55                    {
 056                        array.Add(AspectRelation.DeserializeAspectRelation(item));
 57                    }
 058                    relations = array;
 59                    continue;
 60                }
 61            }
 062            return new SentenceAspect(sentiment, confidenceScores, offset, length, text, relations);
 63        }
 64    }
 65}