< Summary

Class:Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models.Prediction
Assembly:Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Language.LUIS.Runtime\src\Generated\Models\Prediction.cs
Covered lines:6
Uncovered lines:21
Coverable lines:27
Total lines:127
Line coverage:22.2% (6 of 27)
Covered branches:0
Total branches:14
Branch coverage:0% (0 of 14)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-0%100%
get_AlteredQuery()-0%100%
get_TopIntent()-100%100%
get_Intents()-100%100%
get_Entities()-100%100%
get_Sentiment()-100%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Language.LUIS.Runtime\src\Generated\Models\Prediction.cs

#LineLine coverage
 1// <auto-generated>
 2// Copyright (c) Microsoft Corporation. All rights reserved.
 3// Licensed under the MIT License. See License.txt in the project root for
 4// license information.
 5//
 6// Code generated by Microsoft (R) AutoRest Code Generator.
 7// Changes may cause incorrect behavior and will be lost if the code is
 8// regenerated.
 9// </auto-generated>
 10
 11namespace Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime.Models
 12{
 13    using Microsoft.Rest;
 14    using Newtonsoft.Json;
 15    using System.Collections;
 16    using System.Collections.Generic;
 17    using System.Linq;
 18
 19    /// <summary>
 20    /// Represents the prediction of a query.
 21    /// </summary>
 22    public partial class Prediction
 23    {
 24        /// <summary>
 25        /// Initializes a new instance of the Prediction class.
 26        /// </summary>
 827        public Prediction()
 28        {
 29            CustomInit();
 830        }
 31
 32        /// <summary>
 33        /// Initializes a new instance of the Prediction class.
 34        /// </summary>
 35        /// <param name="topIntent">The name of the top scoring intent.</param>
 36        /// <param name="intents">A dictionary representing the intents that
 37        /// fired.</param>
 38        /// <param name="entities">A dictionary representing the entities that
 39        /// fired.</param>
 40        /// <param name="alteredQuery">The query after spell checking. Only set
 41        /// if spell check was enabled and a spelling mistake was
 42        /// found.</param>
 43        /// <param name="sentiment">The result of the sentiment
 44        /// analysis.</param>
 045        public Prediction(string topIntent, IDictionary<string, Intent> intents, IDictionary<string, object> entities, s
 46        {
 047            AlteredQuery = alteredQuery;
 048            TopIntent = topIntent;
 049            Intents = intents;
 050            Entities = entities;
 051            Sentiment = sentiment;
 52            CustomInit();
 053        }
 54
 55        /// <summary>
 56        /// An initialization method that performs custom operations like setting defaults
 57        /// </summary>
 58        partial void CustomInit();
 59
 60        /// <summary>
 61        /// Gets or sets the query after spell checking. Only set if spell
 62        /// check was enabled and a spelling mistake was found.
 63        /// </summary>
 64        [JsonProperty(PropertyName = "alteredQuery")]
 065        public string AlteredQuery { get; set; }
 66
 67        /// <summary>
 68        /// Gets or sets the name of the top scoring intent.
 69        /// </summary>
 70        [JsonProperty(PropertyName = "topIntent")]
 2471        public string TopIntent { get; set; }
 72
 73        /// <summary>
 74        /// Gets or sets a dictionary representing the intents that fired.
 75        /// </summary>
 76        [JsonProperty(PropertyName = "intents")]
 3277        public IDictionary<string, Intent> Intents { get; set; }
 78
 79        /// <summary>
 80        /// Gets or sets a dictionary representing the entities that fired.
 81        /// </summary>
 82        [JsonProperty(PropertyName = "entities")]
 5283        public IDictionary<string, object> Entities { get; set; }
 84
 85        /// <summary>
 86        /// Gets or sets the result of the sentiment analysis.
 87        /// </summary>
 88        [JsonProperty(PropertyName = "sentiment")]
 3289        public Sentiment Sentiment { get; set; }
 90
 91        /// <summary>
 92        /// Validate the object.
 93        /// </summary>
 94        /// <exception cref="ValidationException">
 95        /// Thrown if validation fails
 96        /// </exception>
 97        public virtual void Validate()
 98        {
 099            if (TopIntent == null)
 100            {
 0101                throw new ValidationException(ValidationRules.CannotBeNull, "TopIntent");
 102            }
 0103            if (Intents == null)
 104            {
 0105                throw new ValidationException(ValidationRules.CannotBeNull, "Intents");
 106            }
 0107            if (Entities == null)
 108            {
 0109                throw new ValidationException(ValidationRules.CannotBeNull, "Entities");
 110            }
 0111            if (Intents != null)
 112            {
 0113                foreach (var valueElement in Intents.Values)
 114                {
 0115                    if (valueElement != null)
 116                    {
 0117                        valueElement.Validate();
 118                    }
 119                }
 120            }
 0121            if (Sentiment != null)
 122            {
 0123                Sentiment.Validate();
 124            }
 0125        }
 126    }
 127}