< Summary

Class:Microsoft.Azure.Search.SynonymMapsOperationsExtensions
Assembly:Microsoft.Azure.Search.Service
File(s):C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Customizations\SynonymMaps\SynonymMapsOperationsExtensions.Customization.cs
C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\SynonymMapsOperationsExtensions.cs
Covered lines:24
Uncovered lines:4
Coverable lines:28
Total lines:364
Line coverage:85.7% (24 of 28)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
CreateOrUpdate(...)-100%100%
CreateOrUpdateAsync()-100%100%
Exists(...)-100%100%
ExistsAsync()-100%100%
CreateOrUpdate(...)-0%100%
CreateOrUpdateAsync()-0%100%
Delete(...)-100%100%
DeleteAsync()-100%100%
Get(...)-100%100%
GetAsync()-100%100%
List(...)-100%100%
ListAsync()-100%100%
Create(...)-100%100%
CreateAsync()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Customizations\SynonymMaps\SynonymMapsOperationsExtensions.Customization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for
 3// license information.
 4
 5namespace Microsoft.Azure.Search
 6{
 7    using System.Threading;
 8    using System.Threading.Tasks;
 9    using Microsoft.Azure.Search.Models;
 10    using Microsoft.Rest.Azure;
 11
 12    /// <summary>
 13    /// Operations for managing synonymmaps.
 14    /// </summary>
 15    public static partial class SynonymMapsOperationsExtensions
 16    {
 17        /// <summary>
 18        /// Creates a new synonym map or updates a synonym map if it
 19        /// already exists.
 20        /// <see href="https://docs.microsoft.com/rest/api/searchservice/Update-Synonym-Map" />
 21        /// </summary>
 22        /// <param name='operations'>
 23        /// The operations group for this extension method.
 24        /// </param>
 25        /// <param name='synonymMap'>
 26        /// The definition of the synonymmap to create or update.
 27        /// </param>
 28        /// <param name='searchRequestOptions'>
 29        /// Additional parameters for the operation.
 30        /// </param>
 31        /// <param name='accessCondition'>
 32        /// Additional parameters for the operation.
 33        /// </param>
 34        /// <returns>The synonym map that was created or updated.</returns>
 35        public static SynonymMap CreateOrUpdate(this ISynonymMapsOperations operations, SynonymMap synonymMap, SearchReq
 36        {
 3037            return operations.CreateOrUpdateAsync(synonymMap, searchRequestOptions, accessCondition).GetAwaiter().GetRes
 38        }
 39
 40        /// <summary>
 41        /// Creates a new synonym map or updates a synonym map if it
 42        /// already exists.
 43        /// <see href="https://docs.microsoft.com/rest/api/searchservice/Update-Synonym-Map" />
 44        /// </summary>
 45        /// <param name='operations'>
 46        /// The operations group for this extension method.
 47        /// </param>
 48        /// <param name='synonymMap'>
 49        /// The definition of the synonymmap to create or update.
 50        /// </param>
 51        /// <param name='searchRequestOptions'>
 52        /// Additional parameters for the operation.
 53        /// </param>
 54        /// <param name='accessCondition'>
 55        /// Additional parameters for the operation.
 56        /// </param>
 57        /// <param name='cancellationToken'>
 58        /// The cancellation token.
 59        /// </param>
 60        /// <returns>The synonym map that was created or updated.</returns>
 61        public static async Task<SynonymMap> CreateOrUpdateAsync(this ISynonymMapsOperations operations, SynonymMap syno
 62        {
 3063            using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(synonymMap, searchRequestOptions, 
 64            {
 2465                return _result.Body;
 66            }
 2467        }
 68
 69        /// <summary>
 70        /// Determines whether or not the given synonym map exists in the search service.
 71        /// </summary>
 72        /// <param name='operations'>
 73        /// The operations group for this extension method.
 74        /// </param>
 75        /// <param name="synonymMapName">
 76        /// The name of the synonym map.
 77        /// </param>
 78        /// <param name='searchRequestOptions'>
 79        /// Additional parameters for the operation.
 80        /// </param>
 81        /// <returns>
 82        /// <c>true</c> if the synonym map exists; <c>false</c> otherwise.
 83        /// </returns>
 84        public static bool Exists(
 85            this ISynonymMapsOperations operations,
 86            string synonymMapName,
 87            SearchRequestOptions searchRequestOptions = default(SearchRequestOptions))
 88        {
 489            return operations.ExistsAsync(synonymMapName, searchRequestOptions).GetAwaiter().GetResult();
 90        }
 91
 92        /// <summary>
 93        /// Determines whether or not the given synonym map exists in the search service.
 94        /// </summary>
 95        /// <param name='operations'>
 96        /// The operations group for this extension method.
 97        /// </param>
 98        /// <param name="synonymMapName">
 99        /// The name of the synonym map.
 100        /// </param>
 101        /// <param name='searchRequestOptions'>
 102        /// Additional parameters for the operation.
 103        /// </param>
 104        /// <param name='cancellationToken'>
 105        /// The cancellation token.
 106        /// </param>
 107        /// <returns>
 108        /// <c>true</c> if the synonym map exists; <c>false</c> otherwise.
 109        /// </returns>
 110        public static async Task<bool> ExistsAsync(
 111            this ISynonymMapsOperations operations,
 112            string synonymMapName,
 113            SearchRequestOptions searchRequestOptions = default(SearchRequestOptions),
 114            CancellationToken cancellationToken = default(CancellationToken))
 115        {
 4116            AzureOperationResponse<bool> result = await operations.ExistsWithHttpMessagesAsync(synonymMapName, searchReq
 4117            return result.Body;
 4118        }
 119    }
 120}

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Generated\SynonymMapsOperationsExtensions.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
 12{
 13    using Microsoft.Rest;
 14    using Microsoft.Rest.Azure;
 15    using Models;
 16    using System.Threading;
 17    using System.Threading.Tasks;
 18
 19    /// <summary>
 20    /// Extension methods for SynonymMapsOperations.
 21    /// </summary>
 22    public static partial class SynonymMapsOperationsExtensions
 23    {
 24            /// <summary>
 25            /// Creates a new synonym map or updates a synonym map if it already exists.
 26            /// <see href="https://docs.microsoft.com/rest/api/searchservice/Update-Synonym-Map" />
 27            /// </summary>
 28            /// <param name='operations'>
 29            /// The operations group for this extension method.
 30            /// </param>
 31            /// <param name='synonymMapName'>
 32            /// The name of the synonym map to create or update.
 33            /// </param>
 34            /// <param name='synonymMap'>
 35            /// The definition of the synonym map to create or update.
 36            /// </param>
 37            /// <param name='searchRequestOptions'>
 38            /// Additional parameters for the operation
 39            /// </param>
 40            /// <param name='accessCondition'>
 41            /// Additional parameters for the operation
 42            /// </param>
 43            public static SynonymMap CreateOrUpdate(this ISynonymMapsOperations operations, string synonymMapName, Synon
 44            {
 045                return operations.CreateOrUpdateAsync(synonymMapName, synonymMap, searchRequestOptions, accessCondition)
 46            }
 47
 48            /// <summary>
 49            /// Creates a new synonym map or updates a synonym map if it already exists.
 50            /// <see href="https://docs.microsoft.com/rest/api/searchservice/Update-Synonym-Map" />
 51            /// </summary>
 52            /// <param name='operations'>
 53            /// The operations group for this extension method.
 54            /// </param>
 55            /// <param name='synonymMapName'>
 56            /// The name of the synonym map to create or update.
 57            /// </param>
 58            /// <param name='synonymMap'>
 59            /// The definition of the synonym map to create or update.
 60            /// </param>
 61            /// <param name='searchRequestOptions'>
 62            /// Additional parameters for the operation
 63            /// </param>
 64            /// <param name='accessCondition'>
 65            /// Additional parameters for the operation
 66            /// </param>
 67            /// <param name='cancellationToken'>
 68            /// The cancellation token.
 69            /// </param>
 70            public static async Task<SynonymMap> CreateOrUpdateAsync(this ISynonymMapsOperations operations, string syno
 71            {
 072                using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(synonymMapName, synonymMap, se
 73                {
 074                    return _result.Body;
 75                }
 076            }
 77
 78            /// <summary>
 79            /// Deletes a synonym map.
 80            /// <see href="https://docs.microsoft.com/rest/api/searchservice/Delete-Synonym-Map" />
 81            /// </summary>
 82            /// <param name='operations'>
 83            /// The operations group for this extension method.
 84            /// </param>
 85            /// <param name='synonymMapName'>
 86            /// The name of the synonym map to delete.
 87            /// </param>
 88            /// <param name='searchRequestOptions'>
 89            /// Additional parameters for the operation
 90            /// </param>
 91            /// <param name='accessCondition'>
 92            /// Additional parameters for the operation
 93            /// </param>
 94            public static void Delete(this ISynonymMapsOperations operations, string synonymMapName, SearchRequestOption
 95            {
 1296                operations.DeleteAsync(synonymMapName, searchRequestOptions, accessCondition).GetAwaiter().GetResult();
 897            }
 98
 99            /// <summary>
 100            /// Deletes a synonym map.
 101            /// <see href="https://docs.microsoft.com/rest/api/searchservice/Delete-Synonym-Map" />
 102            /// </summary>
 103            /// <param name='operations'>
 104            /// The operations group for this extension method.
 105            /// </param>
 106            /// <param name='synonymMapName'>
 107            /// The name of the synonym map to delete.
 108            /// </param>
 109            /// <param name='searchRequestOptions'>
 110            /// Additional parameters for the operation
 111            /// </param>
 112            /// <param name='accessCondition'>
 113            /// Additional parameters for the operation
 114            /// </param>
 115            /// <param name='cancellationToken'>
 116            /// The cancellation token.
 117            /// </param>
 118            public static async Task DeleteAsync(this ISynonymMapsOperations operations, string synonymMapName, SearchRe
 119            {
 12120                (await operations.DeleteWithHttpMessagesAsync(synonymMapName, searchRequestOptions, accessCondition, nul
 8121            }
 122
 123            /// <summary>
 124            /// Retrieves a synonym map definition.
 125            /// <see href="https://docs.microsoft.com/rest/api/searchservice/Get-Synonym-Map" />
 126            /// </summary>
 127            /// <param name='operations'>
 128            /// The operations group for this extension method.
 129            /// </param>
 130            /// <param name='synonymMapName'>
 131            /// The name of the synonym map to retrieve.
 132            /// </param>
 133            /// <param name='searchRequestOptions'>
 134            /// Additional parameters for the operation
 135            /// </param>
 136            public static SynonymMap Get(this ISynonymMapsOperations operations, string synonymMapName, SearchRequestOpt
 137            {
 4138                return operations.GetAsync(synonymMapName, searchRequestOptions).GetAwaiter().GetResult();
 139            }
 140
 141            /// <summary>
 142            /// Retrieves a synonym map definition.
 143            /// <see href="https://docs.microsoft.com/rest/api/searchservice/Get-Synonym-Map" />
 144            /// </summary>
 145            /// <param name='operations'>
 146            /// The operations group for this extension method.
 147            /// </param>
 148            /// <param name='synonymMapName'>
 149            /// The name of the synonym map to retrieve.
 150            /// </param>
 151            /// <param name='searchRequestOptions'>
 152            /// Additional parameters for the operation
 153            /// </param>
 154            /// <param name='cancellationToken'>
 155            /// The cancellation token.
 156            /// </param>
 157            public static async Task<SynonymMap> GetAsync(this ISynonymMapsOperations operations, string synonymMapName,
 158            {
 4159                using (var _result = await operations.GetWithHttpMessagesAsync(synonymMapName, searchRequestOptions, nul
 160                {
 2161                    return _result.Body;
 162                }
 2163            }
 164
 165            /// <summary>
 166            /// Lists all synonym maps available for a search service.
 167            /// <see href="https://docs.microsoft.com/rest/api/searchservice/List-Synonym-Maps" />
 168            /// </summary>
 169            /// <param name='operations'>
 170            /// The operations group for this extension method.
 171            /// </param>
 172            /// <param name='searchRequestOptions'>
 173            /// Additional parameters for the operation
 174            /// </param>
 175            public static SynonymMapListResult List(this ISynonymMapsOperations operations, SearchRequestOptions searchR
 176            {
 2177                return operations.ListAsync(searchRequestOptions).GetAwaiter().GetResult();
 178            }
 179
 180            /// <summary>
 181            /// Lists all synonym maps available for a search service.
 182            /// <see href="https://docs.microsoft.com/rest/api/searchservice/List-Synonym-Maps" />
 183            /// </summary>
 184            /// <param name='operations'>
 185            /// The operations group for this extension method.
 186            /// </param>
 187            /// <param name='searchRequestOptions'>
 188            /// Additional parameters for the operation
 189            /// </param>
 190            /// <param name='cancellationToken'>
 191            /// The cancellation token.
 192            /// </param>
 193            public static async Task<SynonymMapListResult> ListAsync(this ISynonymMapsOperations operations, SearchReque
 194            {
 2195                using (var _result = await operations.ListWithHttpMessagesAsync(searchRequestOptions, null, cancellation
 196                {
 2197                    return _result.Body;
 198                }
 2199            }
 200
 201            /// <summary>
 202            /// Creates a new synonym map.
 203            /// <see href="https://docs.microsoft.com/rest/api/searchservice/Create-Synonym-Map" />
 204            /// </summary>
 205            /// <param name='operations'>
 206            /// The operations group for this extension method.
 207            /// </param>
 208            /// <param name='synonymMap'>
 209            /// The definition of the synonym map to create.
 210            /// </param>
 211            /// <param name='searchRequestOptions'>
 212            /// Additional parameters for the operation
 213            /// </param>
 214            public static SynonymMap Create(this ISynonymMapsOperations operations, SynonymMap synonymMap, SearchRequest
 215            {
 24216                return operations.CreateAsync(synonymMap, searchRequestOptions).GetAwaiter().GetResult();
 217            }
 218
 219            /// <summary>
 220            /// Creates a new synonym map.
 221            /// <see href="https://docs.microsoft.com/rest/api/searchservice/Create-Synonym-Map" />
 222            /// </summary>
 223            /// <param name='operations'>
 224            /// The operations group for this extension method.
 225            /// </param>
 226            /// <param name='synonymMap'>
 227            /// The definition of the synonym map to create.
 228            /// </param>
 229            /// <param name='searchRequestOptions'>
 230            /// Additional parameters for the operation
 231            /// </param>
 232            /// <param name='cancellationToken'>
 233            /// The cancellation token.
 234            /// </param>
 235            public static async Task<SynonymMap> CreateAsync(this ISynonymMapsOperations operations, SynonymMap synonymM
 236            {
 24237                using (var _result = await operations.CreateWithHttpMessagesAsync(synonymMap, searchRequestOptions, null
 238                {
 22239                    return _result.Body;
 240                }
 22241            }
 242
 243    }
 244}