@@ -53,7 +53,7 @@ public void ClearAzureProfileClearsDefaultProfile()
53
53
{
54
54
ClearAzureProfileCommand cmdlt = new ClearAzureProfileCommand ( ) ;
55
55
// Setup
56
- ProfileClient client = new ProfileClient ( ) ;
56
+ ProfileClient client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
57
57
client . AddOrSetAccount ( azureAccount ) ;
58
58
client . AddOrSetEnvironment ( azureEnvironment ) ;
59
59
client . AddOrSetSubscription ( azureSubscription1 ) ;
@@ -68,7 +68,7 @@ public void ClearAzureProfileClearsDefaultProfile()
68
68
cmdlt . InvokeEndProcessing ( ) ;
69
69
70
70
// Verify
71
- client = new ProfileClient ( ) ;
71
+ client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
72
72
Assert . Equal ( 0 , client . Profile . Subscriptions . Count ) ;
73
73
Assert . Equal ( 0 , client . Profile . Accounts . Count ) ;
74
74
Assert . Equal ( 2 , client . Profile . Environments . Count ) ; //only default environments
@@ -81,7 +81,7 @@ public void ClearAzureProfileClearsCustomProfile()
81
81
82
82
ClearAzureProfileCommand cmdlt = new ClearAzureProfileCommand ( ) ;
83
83
// Setup
84
- ProfileClient client = new ProfileClient ( subscriptionDataFile ) ;
84
+ ProfileClient client = new ProfileClient ( new AzureProfile ( subscriptionDataFile ) ) ;
85
85
client . AddOrSetAccount ( azureAccount ) ;
86
86
client . AddOrSetEnvironment ( azureEnvironment ) ;
87
87
client . AddOrSetSubscription ( azureSubscription1 ) ;
@@ -97,7 +97,7 @@ public void ClearAzureProfileClearsCustomProfile()
97
97
cmdlt . InvokeEndProcessing ( ) ;
98
98
99
99
// Verify
100
- client = new ProfileClient ( subscriptionDataFile ) ;
100
+ client = new ProfileClient ( new AzureProfile ( subscriptionDataFile ) ) ;
101
101
Assert . Equal ( 0 , client . Profile . Subscriptions . Count ) ;
102
102
Assert . Equal ( 0 , client . Profile . Accounts . Count ) ;
103
103
Assert . Equal ( 2 , client . Profile . Environments . Count ) ; //only default environments
@@ -177,7 +177,7 @@ public void SetAzureSubscriptionAddsSubscriptionWithCertificate()
177
177
cmdlt . InvokeEndProcessing ( ) ;
178
178
179
179
// Verify
180
- ProfileClient client = new ProfileClient ( ) ;
180
+ ProfileClient client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
181
181
var newSubscription = client . Profile . Subscriptions [ new Guid ( cmdlt . SubscriptionId ) ] ;
182
182
var newAccount = client . Profile . Accounts [ SampleCertificate . Thumbprint ] ;
183
183
Assert . Equal ( cmdlt . SubscriptionName , newSubscription . Name ) ;
@@ -194,7 +194,7 @@ public void SetAzureSubscriptionAddsSubscriptionWithCertificate()
194
194
public void SetAzureSubscriptionDerivesEnvironmentFromEnvironmentParameterOnAdd ( )
195
195
{
196
196
// Setup
197
- ProfileClient client = new ProfileClient ( ) ;
197
+ ProfileClient client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
198
198
client . AddOrSetEnvironment ( azureEnvironment ) ;
199
199
client . Profile . Save ( ) ;
200
200
SetAzureSubscriptionCommand cmdlt = new SetAzureSubscriptionCommand ( ) ;
@@ -212,7 +212,7 @@ public void SetAzureSubscriptionDerivesEnvironmentFromEnvironmentParameterOnAdd(
212
212
cmdlt . InvokeEndProcessing ( ) ;
213
213
214
214
// Verify
215
- client = new ProfileClient ( ) ;
215
+ client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
216
216
var newSubscription = client . Profile . Subscriptions [ new Guid ( cmdlt . SubscriptionId ) ] ;
217
217
Assert . Equal ( cmdlt . SubscriptionName , newSubscription . Name ) ;
218
218
Assert . Equal ( cmdlt . Environment , newSubscription . Environment ) ;
@@ -224,7 +224,7 @@ public void SetAzureSubscriptionThrowsExceptionWithoutCertificateOnAdd()
224
224
{
225
225
SetAzureSubscriptionCommand cmdlt = new SetAzureSubscriptionCommand ( ) ;
226
226
// Setup
227
- ProfileClient client = new ProfileClient ( ) ;
227
+ ProfileClient client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
228
228
client . AddOrSetEnvironment ( azureEnvironment ) ;
229
229
client . Profile . Save ( ) ;
230
230
@@ -243,7 +243,7 @@ public void SetAzureSubscriptionThrowsExceptionWithoutCertificateOnAdd()
243
243
public void SetAzureSubscriptionDerivesEnvironmentFromEnvironmentParameterOnSet ( )
244
244
{
245
245
// Setup
246
- ProfileClient client = new ProfileClient ( ) ;
246
+ ProfileClient client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
247
247
client . AddOrSetAccount ( azureAccount ) ;
248
248
client . AddOrSetEnvironment ( azureEnvironment ) ;
249
249
client . AddOrSetSubscription ( azureSubscription1 ) ;
@@ -261,7 +261,7 @@ public void SetAzureSubscriptionDerivesEnvironmentFromEnvironmentParameterOnSet(
261
261
cmdlt . InvokeEndProcessing ( ) ;
262
262
263
263
// Verify
264
- client = new ProfileClient ( ) ;
264
+ client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
265
265
var newSubscription = client . Profile . Subscriptions [ new Guid ( cmdlt . SubscriptionId ) ] ;
266
266
Assert . Equal ( cmdlt . Environment , newSubscription . Environment ) ;
267
267
Assert . Equal ( cmdlt . CurrentStorageAccountName , newSubscription . GetProperty ( AzureSubscription . Property . StorageAccount ) ) ;
@@ -271,7 +271,7 @@ public void SetAzureSubscriptionDerivesEnvironmentFromEnvironmentParameterOnSet(
271
271
public void SetAzureSubscriptionDerivesEnvironmentFromServiceEndpointParameterOnSet ( )
272
272
{
273
273
// Setup
274
- ProfileClient client = new ProfileClient ( ) ;
274
+ ProfileClient client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
275
275
client . AddOrSetAccount ( azureAccount ) ;
276
276
client . AddOrSetEnvironment ( azureEnvironment ) ;
277
277
client . AddOrSetSubscription ( azureSubscription1 ) ;
@@ -289,7 +289,7 @@ public void SetAzureSubscriptionDerivesEnvironmentFromServiceEndpointParameterOn
289
289
cmdlt . InvokeEndProcessing ( ) ;
290
290
291
291
// Verify
292
- client = new ProfileClient ( ) ;
292
+ client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
293
293
var newSubscription = client . Profile . Subscriptions [ new Guid ( cmdlt . SubscriptionId ) ] ;
294
294
Assert . Equal ( cmdlt . Environment , newSubscription . Environment ) ;
295
295
Assert . Equal ( cmdlt . CurrentStorageAccountName ,
@@ -300,7 +300,7 @@ public void SetAzureSubscriptionDerivesEnvironmentFromServiceEndpointParameterOn
300
300
public void SetAzureSubscriptionDerivesEnvironmentFromResourcesEndpointParameterOnSet ( )
301
301
{
302
302
// Setup
303
- ProfileClient client = new ProfileClient ( ) ;
303
+ ProfileClient client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
304
304
client . AddOrSetAccount ( azureAccount ) ;
305
305
client . AddOrSetEnvironment ( azureEnvironment ) ;
306
306
client . AddOrSetSubscription ( azureSubscription1 ) ;
@@ -318,7 +318,7 @@ public void SetAzureSubscriptionDerivesEnvironmentFromResourcesEndpointParameter
318
318
cmdlt . InvokeEndProcessing ( ) ;
319
319
320
320
// Verify
321
- client = new ProfileClient ( ) ;
321
+ client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
322
322
var newSubscription = client . Profile . Subscriptions [ new Guid ( cmdlt . SubscriptionId ) ] ;
323
323
Assert . Equal ( cmdlt . Environment , newSubscription . Environment ) ;
324
324
Assert . Equal ( cmdlt . CurrentStorageAccountName , newSubscription . GetProperty ( AzureSubscription . Property . StorageAccount ) ) ;
@@ -328,7 +328,7 @@ public void SetAzureSubscriptionDerivesEnvironmentFromResourcesEndpointParameter
328
328
public void SetAzureSubscriptionDerivesEnvironmentFromBothEndpointParameters ( )
329
329
{
330
330
// Setup
331
- ProfileClient client = new ProfileClient ( ) ;
331
+ ProfileClient client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
332
332
client . AddOrSetAccount ( azureAccount ) ;
333
333
client . AddOrSetEnvironment ( azureEnvironment ) ;
334
334
client . AddOrSetSubscription ( azureSubscription1 ) ;
@@ -348,7 +348,7 @@ public void SetAzureSubscriptionDerivesEnvironmentFromBothEndpointParameters()
348
348
cmdlt . InvokeEndProcessing ( ) ;
349
349
350
350
// Verify
351
- client = new ProfileClient ( ) ;
351
+ client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
352
352
var newSubscription = client . Profile . Subscriptions [ new Guid ( cmdlt . SubscriptionId ) ] ;
353
353
Assert . Equal ( cmdlt . Environment , newSubscription . Environment ) ;
354
354
Assert . Equal ( cmdlt . CurrentStorageAccountName , newSubscription . GetProperty ( AzureSubscription . Property . StorageAccount ) ) ;
@@ -358,7 +358,7 @@ public void SetAzureSubscriptionDerivesEnvironmentFromBothEndpointParameters()
358
358
public void SetAzureSubscriptionUpdatesSubscriptionWithCertificate ( )
359
359
{
360
360
// Setup
361
- ProfileClient client = new ProfileClient ( ) ;
361
+ ProfileClient client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
362
362
client . AddOrSetAccount ( azureAccount ) ;
363
363
client . AddOrSetEnvironment ( azureEnvironment ) ;
364
364
client . AddOrSetSubscription ( azureSubscription1 ) ;
@@ -377,7 +377,7 @@ public void SetAzureSubscriptionUpdatesSubscriptionWithCertificate()
377
377
cmdlt . InvokeEndProcessing ( ) ;
378
378
379
379
// Verify
380
- client = new ProfileClient ( ) ;
380
+ client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
381
381
var newSubscription = client . Profile . Subscriptions [ new Guid ( cmdlt . SubscriptionId ) ] ;
382
382
var newAccount = client . Profile . Accounts [ SampleCertificate . Thumbprint ] ;
383
383
var existingAccount = client . Profile . Accounts [ azureAccount . Id ] ;
@@ -402,14 +402,14 @@ public void ImportPublishSettingsFileSelectsCorrectEnvironment()
402
402
// Setup
403
403
AzureSession . DataStore . WriteFile ( "ImportPublishSettingsFileSelectsCorrectEnvironment.publishsettings" ,
404
404
Properties . Resources . ValidProfileChina ) ;
405
- ProfileClient client = new ProfileClient ( ) ;
405
+ ProfileClient client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
406
406
var oldDataStore = FileUtilities . DataStore ;
407
407
FileUtilities . DataStore = AzureSession . DataStore ;
408
408
var expectedEnv = "AzureChinaCloud" ;
409
409
var expected = client . ImportPublishSettings ( "ImportPublishSettingsFileSelectsCorrectEnvironment.publishsettings" , null ) ;
410
410
411
411
cmdlt . CommandRuntime = commandRuntimeMock ;
412
- cmdlt . ProfileClient = new ProfileClient ( ) ;
412
+ cmdlt . ProfileClient = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
413
413
cmdlt . PublishSettingsFile = "ImportPublishSettingsFileSelectsCorrectEnvironment.publishsettings" ;
414
414
415
415
try
@@ -441,14 +441,14 @@ public void ImportPublishSettingsFileOverwritesEnvironment()
441
441
// Setup
442
442
AzureSession . DataStore . WriteFile ( "ImportPublishSettingsFileSelectsCorrectEnvironment.publishsettings" ,
443
443
Properties . Resources . ValidProfileChina ) ;
444
- ProfileClient client = new ProfileClient ( ) ;
444
+ ProfileClient client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
445
445
var oldDataStore = FileUtilities . DataStore ;
446
446
FileUtilities . DataStore = AzureSession . DataStore ;
447
447
var expectedEnv = "AzureCloud" ;
448
448
var expected = client . ImportPublishSettings ( "ImportPublishSettingsFileSelectsCorrectEnvironment.publishsettings" , expectedEnv ) ;
449
449
450
450
cmdlt . CommandRuntime = commandRuntimeMock ;
451
- cmdlt . ProfileClient = new ProfileClient ( ) ;
451
+ cmdlt . ProfileClient = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
452
452
cmdlt . PublishSettingsFile = "ImportPublishSettingsFileSelectsCorrectEnvironment.publishsettings" ;
453
453
cmdlt . Environment = expectedEnv ;
454
454
@@ -492,7 +492,7 @@ public void SelectDefaultAzureSubscriptionByNameUpdatesProfile()
492
492
cmdlt . InvokeEndProcessing ( ) ;
493
493
494
494
// Verify
495
- client = new ProfileClient ( ) ;
495
+ client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
496
496
Assert . NotNull ( client . Profile . DefaultSubscription ) ;
497
497
Assert . Equal ( azureSubscription2 . Id , client . Profile . DefaultSubscription . Id ) ;
498
498
}
@@ -580,7 +580,7 @@ public void SelectDefaultAzureSubscriptionByIdAndNoDefaultUpdatesProfile()
580
580
cmdlt . InvokeEndProcessing ( ) ;
581
581
582
582
// Verify
583
- client = new ProfileClient ( ) ;
583
+ client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
584
584
Assert . NotNull ( client . Profile . DefaultSubscription ) ;
585
585
Assert . Equal ( azureSubscription2 . Id , client . Profile . DefaultSubscription . Id ) ;
586
586
@@ -597,7 +597,7 @@ public void SelectDefaultAzureSubscriptionByIdAndNoDefaultUpdatesProfile()
597
597
cmdlt . InvokeEndProcessing ( ) ;
598
598
599
599
// Verify
600
- client = new ProfileClient ( ) ;
600
+ client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
601
601
Assert . Null ( client . Profile . DefaultSubscription ) ;
602
602
}
603
603
@@ -654,7 +654,7 @@ public void SelectAzureSubscriptionByInvalidGuidThrowsException()
654
654
655
655
private ProfileClient SetupDefaultProfile ( )
656
656
{
657
- ProfileClient client = new ProfileClient ( ) ;
657
+ ProfileClient client = new ProfileClient ( new AzureProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ) ;
658
658
client . AddOrSetEnvironment ( azureEnvironment ) ;
659
659
client . AddOrSetAccount ( azureAccount ) ;
660
660
client . AddOrSetSubscription ( azureSubscription1 ) ;
0 commit comments