< Summary

Class:Microsoft.Azure.Search.Models.SynonymMap
Assembly:Microsoft.Azure.Search.Service
File(s):C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\Models\SynonymMap.cs
Covered lines:16
Uncovered lines:2
Coverable lines:18
Total lines:102
Line coverage:88.8% (16 of 18)
Covered branches:2
Total branches:4
Branch coverage:50% (2 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
.cctor()-100%100%
get_Name()-100%100%
get_Synonyms()-100%100%
get_ETag()-100%100%
get_Format()-100%100%
Validate()-60%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\Models\SynonymMap.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.Search.Models
 12{
 13    using Microsoft.Rest;
 14    using Newtonsoft.Json;
 15    using System.Linq;
 16
 17    /// <summary>
 18    /// Represents a synonym map definition.
 19    /// </summary>
 20    public partial class SynonymMap
 21    {
 22        /// <summary>
 23        /// Initializes a new instance of the SynonymMap class.
 24        /// </summary>
 5625        public SynonymMap()
 26        {
 27            CustomInit();
 5628        }
 29
 30        /// <summary>
 31        /// Initializes a new instance of the SynonymMap class.
 32        /// </summary>
 33        /// <param name="name">The name of the synonym map.</param>
 34        /// <param name="synonyms">A series of synonym rules in the specified
 35        /// synonym map format. The rules must be separated by
 36        /// newlines.</param>
 37        /// <param name="eTag">The ETag of the synonym map.</param>
 4438        public SynonymMap(string name, string synonyms, string eTag = default(string))
 39        {
 4440            Name = name;
 4441            Synonyms = synonyms;
 4442            ETag = eTag;
 43            CustomInit();
 4444        }
 45        /// <summary>
 46        /// Static constructor for SynonymMap class.
 47        /// </summary>
 48        static SynonymMap()
 49        {
 250            Format = "solr";
 251        }
 52
 53        /// <summary>
 54        /// An initialization method that performs custom operations like setting defaults
 55        /// </summary>
 56        partial void CustomInit();
 57
 58        /// <summary>
 59        /// Gets or sets the name of the synonym map.
 60        /// </summary>
 61        [JsonProperty(PropertyName = "name")]
 28862        public string Name { get; set; }
 63
 64        /// <summary>
 65        /// Gets or sets a series of synonym rules in the specified synonym map
 66        /// format. The rules must be separated by newlines.
 67        /// </summary>
 68        [JsonProperty(PropertyName = "synonyms")]
 23869        public string Synonyms { get; set; }
 70
 71        /// <summary>
 72        /// Gets or sets the ETag of the synonym map.
 73        /// </summary>
 74        [JsonProperty(PropertyName = "@odata.etag")]
 19875        public string ETag { get; set; }
 76
 77        /// <summary>
 78        /// The format of the synonym map. Only the 'solr' format is currently
 79        /// supported.
 80        /// </summary>
 81        [JsonProperty(PropertyName = "format")]
 11482        public static string Format { get; private set; }
 83
 84        /// <summary>
 85        /// Validate the object.
 86        /// </summary>
 87        /// <exception cref="ValidationException">
 88        /// Thrown if validation fails
 89        /// </exception>
 90        public virtual void Validate()
 91        {
 5692            if (Name == null)
 93            {
 094                throw new ValidationException(ValidationRules.CannotBeNull, "Name");
 95            }
 5696            if (Synonyms == null)
 97            {
 098                throw new ValidationException(ValidationRules.CannotBeNull, "Synonyms");
 99            }
 56100        }
 101    }
 102}