34
34
using Microsoft . Rest ;
35
35
using Microsoft . Rest . ClientRuntime . Azure . TestFramework ;
36
36
using Microsoft . WindowsAzure . Commands . ScenarioTest ;
37
- using ManagedGroups = Microsoft . Azure . Management . ManagementGroups ;
38
37
using TestEnvironmentFactory = Microsoft . Rest . ClientRuntime . Azure . TestFramework . TestEnvironmentFactory ;
39
38
40
39
namespace Microsoft . Azure . Commands . Resources . Test . ScenarioTests
@@ -56,7 +55,7 @@ public sealed class ResourcesController
56
55
57
56
public AuthorizationManagementClient AuthorizationManagementClient { get ; private set ; }
58
57
59
- public ManagedGroups . ManagementGroupsAPIClient ManagementGroupsApiClient { get ; private set ; }
58
+ public ManagementGroupsAPIClient ManagementGroupsApiClient { get ; private set ; }
60
59
61
60
public string UserDomain { get ; private set ; }
62
61
@@ -90,18 +89,22 @@ public void RunPsTestWorkflow(
90
89
string mockName )
91
90
{
92
91
_helper . TracingInterceptor = interceptor ;
93
- Dictionary < string , string > d = new Dictionary < string , string > ( ) ;
94
- d . Add ( "Microsoft.Resources" , null ) ;
95
- d . Add ( "Microsoft.Features" , null ) ;
96
- d . Add ( "Microsoft.Authorization" , null ) ;
97
- d . Add ( "Providers.Test" , null ) ;
98
- var providersToIgnore = new Dictionary < string , string > ( ) ;
99
- providersToIgnore . Add ( "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient" , "2016-07-01" ) ;
100
- providersToIgnore . Add ( "Microsoft.Azure.Management.Resources.ResourceManagementClient" , "2016-02-01" ) ;
92
+ var d = new Dictionary < string , string >
93
+ {
94
+ { "Microsoft.Resources" , null } ,
95
+ { "Microsoft.Features" , null } ,
96
+ { "Microsoft.Authorization" , null } ,
97
+ { "Providers.Test" , null }
98
+ } ;
99
+ var providersToIgnore = new Dictionary < string , string >
100
+ {
101
+ { "Microsoft.Azure.Management.ResourceManager.ResourceManagementClient" , "2016-07-01" } ,
102
+ { "Microsoft.Azure.Management.Resources.ResourceManagementClient" , "2016-02-01" }
103
+ } ;
101
104
HttpMockServer . Matcher = new ResourcesRecordMatcher ( true , d , providersToIgnore ) ;
102
105
HttpMockServer . RecordsDirectory = Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "SessionRecords" ) ;
103
106
104
- using ( MockContext context = MockContext . Start ( callingClassType , mockName ) )
107
+ using ( var context = MockContext . Start ( callingClassType , mockName ) )
105
108
{
106
109
_helper . SetupEnvironment ( AzureModule . AzureResourceManager ) ;
107
110
@@ -115,7 +118,7 @@ public void RunPsTestWorkflow(
115
118
"ScenarioTests\\ " + callingClassName + ".ps1" ,
116
119
_helper . RMProfileModule ,
117
120
_helper . RMResourceModule ,
118
- _helper . RMInsightsModule ) ;
121
+ _helper . GetRMModulePath ( "AzureRM.Monitor.psd1" ) ) ;
119
122
120
123
try
121
124
{
@@ -195,29 +198,29 @@ private GraphRbacManagementClient GetGraphClient(MockContext context)
195
198
return client ;
196
199
}
197
200
198
- private AuthorizationManagementClient GetAuthorizationManagementClient ( MockContext context )
201
+ private static AuthorizationManagementClient GetAuthorizationManagementClient ( MockContext context )
199
202
{
200
203
return context . GetServiceClient < AuthorizationManagementClient > ( TestEnvironmentFactory . GetTestEnvironment ( ) ) ;
201
204
}
202
205
203
- private FeatureClient GetFeatureClient ( MockContext context )
206
+ private static FeatureClient GetFeatureClient ( MockContext context )
204
207
{
205
208
return context . GetServiceClient < FeatureClient > ( TestEnvironmentFactory . GetTestEnvironment ( ) ) ;
206
209
}
207
210
208
- private ResourceManagementClient GetResourceManagementClient ( MockContext context )
211
+ private static ResourceManagementClient GetResourceManagementClient ( MockContext context )
209
212
{
210
213
return context . GetServiceClient < ResourceManagementClient > ( TestEnvironmentFactory . GetTestEnvironment ( ) ) ;
211
214
}
212
215
213
- private Internal . Subscriptions . SubscriptionClient GetSubscriptionClient ( MockContext context )
216
+ private static Internal . Subscriptions . SubscriptionClient GetSubscriptionClient ( MockContext context )
214
217
{
215
218
return context . GetServiceClient < Internal . Subscriptions . SubscriptionClient > ( TestEnvironmentFactory . GetTestEnvironment ( ) ) ;
216
219
}
217
220
218
- private ManagedGroups . ManagementGroupsAPIClient GetManagementGroupsApiClient ( MockContext context )
221
+ private static ManagementGroupsAPIClient GetManagementGroupsApiClient ( MockContext context )
219
222
{
220
- return context . GetServiceClient < ManagedGroups . ManagementGroupsAPIClient > ( TestEnvironmentFactory . GetTestEnvironment ( ) ) ;
223
+ return context . GetServiceClient < ManagementGroupsAPIClient > ( TestEnvironmentFactory . GetTestEnvironment ( ) ) ;
221
224
}
222
225
223
226
/// <summary>
@@ -228,15 +231,15 @@ private class TestHttpClientHelperFactory : HttpClientHelperFactory
228
231
/// <summary>
229
232
/// The subscription cloud credentials.
230
233
/// </summary>
231
- private readonly SubscriptionCloudCredentials credential ;
234
+ private readonly SubscriptionCloudCredentials _credential ;
232
235
233
236
/// <summary>
234
237
/// Initializes a new instance of the <see cref="TestHttpClientHelperFactory"/> class.
235
238
/// </summary>
236
239
/// <param name="credentials"></param>
237
240
public TestHttpClientHelperFactory ( SubscriptionCloudCredentials credentials )
238
241
{
239
- credential = credentials ;
242
+ _credential = credentials ;
240
243
}
241
244
242
245
/// <summary>
@@ -246,7 +249,7 @@ public TestHttpClientHelperFactory(SubscriptionCloudCredentials credentials)
246
249
/// <param name="headerValues">The headers.</param>
247
250
public override HttpClientHelper CreateHttpClientHelper ( SubscriptionCloudCredentials credentials , IEnumerable < ProductInfoHeaderValue > headerValues , Dictionary < string , string > cmdletHeaderValues )
248
251
{
249
- return new HttpClientHelperImpl ( credentials : credential , headerValues : headerValues , cmdletHeaderValues : cmdletHeaderValues ) ;
252
+ return new HttpClientHelperImpl ( credentials : _credential , headerValues : headerValues , cmdletHeaderValues : cmdletHeaderValues ) ;
250
253
}
251
254
252
255
/// <summary>
0 commit comments