| | 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 | |
|
| | 5 | | namespace Microsoft.Azure.Management.Search.Tests |
| | 6 | | { |
| | 7 | | using System.Linq; |
| | 8 | | using Microsoft.Azure.Management.Search.Models; |
| | 9 | | using Microsoft.Azure.Search.Tests.Utilities; |
| | 10 | | using Xunit; |
| | 11 | |
|
| | 12 | | public sealed class OperationsTests : SearchTestBase<ResourceGroupFixture> |
| | 13 | | { |
| | 14 | | [Fact] |
| | 15 | | public void ListOperationsReturnsExpectedOperations() |
| | 16 | | { |
| 0 | 17 | | Run(() => |
| 0 | 18 | | { |
| 0 | 19 | | SearchManagementClient searchMgmt = GetSearchManagementClient(); |
| 0 | 20 | |
|
| 0 | 21 | | var expectedCoreOperations = new[] |
| 0 | 22 | | { |
| 0 | 23 | | new Operation( |
| 0 | 24 | | name: "Microsoft.Search/register/action", |
| 0 | 25 | | display: new OperationDisplay( |
| 0 | 26 | | provider: "Microsoft Search", |
| 0 | 27 | | operation: "Register the Search Resource Provider", |
| 0 | 28 | | resource: "Search Services", |
| 0 | 29 | | description: "Registers the subscription for the search resource provider and enables the cr |
| 0 | 30 | | new Operation( |
| 0 | 31 | | name: "Microsoft.Search/searchServices/write", |
| 0 | 32 | | display: new OperationDisplay( |
| 0 | 33 | | provider: "Microsoft Search", |
| 0 | 34 | | resource: "Search Services", |
| 0 | 35 | | operation: "Set Search Service", |
| 0 | 36 | | description: "Creates or updates the search service.")), |
| 0 | 37 | | new Operation( |
| 0 | 38 | | name: "Microsoft.Search/searchServices/read", |
| 0 | 39 | | display: new OperationDisplay( |
| 0 | 40 | | provider: "Microsoft Search", |
| 0 | 41 | | resource: "Search Services", |
| 0 | 42 | | operation: "Get Search Service", |
| 0 | 43 | | description: "Reads the search service.")), |
| 0 | 44 | | new Operation( |
| 0 | 45 | | name: "Microsoft.Search/searchServices/delete", |
| 0 | 46 | | display: new OperationDisplay( |
| 0 | 47 | | provider: "Microsoft Search", |
| 0 | 48 | | resource: "Search Services", |
| 0 | 49 | | operation: "Delete Search Service", |
| 0 | 50 | | description: "Deletes the search service.")), |
| 0 | 51 | | new Operation( |
| 0 | 52 | | name: "Microsoft.Search/searchServices/listAdminKeys/action", |
| 0 | 53 | | display: new OperationDisplay( |
| 0 | 54 | | provider: "Microsoft Search", |
| 0 | 55 | | resource: "Search Services", |
| 0 | 56 | | operation: "Get Admin Key", |
| 0 | 57 | | description: "Reads the admin keys.")), |
| 0 | 58 | | new Operation( |
| 0 | 59 | | name: "Microsoft.Search/searchServices/regenerateAdminKey/action", |
| 0 | 60 | | display: new OperationDisplay( |
| 0 | 61 | | provider: "Microsoft Search", |
| 0 | 62 | | resource: "Search Services", |
| 0 | 63 | | operation: "Regenerate Admin Key", |
| 0 | 64 | | description: "Regenerates the admin key.")), |
| 0 | 65 | | new Operation( |
| 0 | 66 | | name: "Microsoft.Search/searchServices/listQueryKeys/action", |
| 0 | 67 | | display: new OperationDisplay( |
| 0 | 68 | | provider: "Microsoft Search", |
| 0 | 69 | | resource: "API Keys", |
| 0 | 70 | | operation: "Get Query Keys", |
| 0 | 71 | | description: "Returns the list of query API keys for the given Azure Search service.")), |
| 0 | 72 | | new Operation( |
| 0 | 73 | | name: "Microsoft.Search/searchServices/createQueryKey/action", |
| 0 | 74 | | display: new OperationDisplay( |
| 0 | 75 | | provider: "Microsoft Search", |
| 0 | 76 | | resource: "Search Services", |
| 0 | 77 | | operation: "Create Query Key", |
| 0 | 78 | | description: "Creates the query key.")), |
| 0 | 79 | | new Operation( |
| 0 | 80 | | name: "Microsoft.Search/searchServices/deleteQueryKey/delete", |
| 0 | 81 | | display: new OperationDisplay( |
| 0 | 82 | | provider: "Microsoft Search", |
| 0 | 83 | | resource: "API Keys", |
| 0 | 84 | | operation: "Delete Query Key", |
| 0 | 85 | | description: "Deletes the query key.")), |
| 0 | 86 | | new Operation( |
| 0 | 87 | | name: "Microsoft.Search/checkNameAvailability/action", |
| 0 | 88 | | display: new OperationDisplay( |
| 0 | 89 | | provider: "Microsoft Search", |
| 0 | 90 | | resource: "Service Name Availability", |
| 0 | 91 | | operation: "Check Service Name Availability", |
| 0 | 92 | | description: "Checks availability of the service name.")), |
| 0 | 93 | | new Operation( |
| 0 | 94 | | name: "Microsoft.Search/searchServices/privateEndpointConnectionProxies/validate/action", |
| 0 | 95 | | display: new OperationDisplay( |
| 0 | 96 | | provider: "Microsoft Search", |
| 0 | 97 | | resource: "Private Endpoint Connection Proxy", |
| 0 | 98 | | operation: "Validate Private Endpoint Connection Proxy", |
| 0 | 99 | | description: "Validates a private endpoint connection create call from NRP side")), |
| 0 | 100 | | new Operation( |
| 0 | 101 | | name: "Microsoft.Search/searchServices/privateEndpointConnectionProxies/write", |
| 0 | 102 | | display: new OperationDisplay( |
| 0 | 103 | | provider: "Microsoft Search", |
| 0 | 104 | | resource: "Private Endpoint Connection Proxy", |
| 0 | 105 | | operation: "Create Private Endpoint Connection Proxy", |
| 0 | 106 | | description: "Creates a private endpoint connection proxy with the specified parameters or u |
| 0 | 107 | | new Operation( |
| 0 | 108 | | name: "Microsoft.Search/searchServices/privateEndpointConnectionProxies/read", |
| 0 | 109 | | display: new OperationDisplay( |
| 0 | 110 | | provider: "Microsoft Search", |
| 0 | 111 | | resource: "Private Endpoint Connection Proxy", |
| 0 | 112 | | operation: "Get Private Endpoint Connection Proxy", |
| 0 | 113 | | description: "Returns the list of private endpoint connection proxies or gets the properties |
| 0 | 114 | | new Operation( |
| 0 | 115 | | name: "Microsoft.Search/searchServices/privateEndpointConnectionProxies/delete", |
| 0 | 116 | | display: new OperationDisplay( |
| 0 | 117 | | provider: "Microsoft Search", |
| 0 | 118 | | resource: "Private Endpoint Connection Proxy", |
| 0 | 119 | | operation: "Delete Private Endpoint Connection Proxy", |
| 0 | 120 | | description: "Deletes an existing private endpoint connection proxy")) |
| 0 | 121 | | }; |
| 0 | 122 | |
|
| 0 | 123 | | Operation[] actualOperations = searchMgmt.Operations.List().ToArray(); |
| 0 | 124 | |
|
| 0 | 125 | | // There may be more operations than just the core ones expected by this test, but we don't |
| 0 | 126 | | // want to break SDK tests every time we add a new operation. |
| 0 | 127 | | foreach (Operation expectedCoreOperation in expectedCoreOperations) |
| 0 | 128 | | { |
| 0 | 129 | | Assert.Contains(expectedCoreOperation, actualOperations, new ModelComparer<Operation>()); |
| 0 | 130 | | } |
| 0 | 131 | | }); |
| 0 | 132 | | } |
| | 133 | | } |
| | 134 | | } |