@@ -344,6 +344,61 @@ public void AddAzureAccountReturnsAccountWithAllSubscriptionsInRdfeMode()
344
344
Assert . False ( account . GetSubscriptions ( client . Profile ) . Any ( s => s . Id == new Guid ( csmSubscription1 . SubscriptionId ) ) ) ;
345
345
}
346
346
347
+ [ Fact ]
348
+ public void AddAzureAccountFiltersEmptyAdClientsInRdfeMode ( )
349
+ {
350
+ var emptyTenantIdrdfeSubscription = new RDFESubscription
351
+ {
352
+ SubscriptionId = "16E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E" ,
353
+ SubscriptionName = "RdfeSub1" ,
354
+ SubscriptionStatus = Microsoft . WindowsAzure . Subscriptions . Models . SubscriptionStatus . Active ,
355
+ ActiveDirectoryTenantId = ""
356
+ } ;
357
+
358
+ var disabledTenantIdrdfeSubscription = new RDFESubscription
359
+ {
360
+ SubscriptionId = "16E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E" ,
361
+ SubscriptionName = "RdfeSub1" ,
362
+ SubscriptionStatus = Microsoft . WindowsAzure . Subscriptions . Models . SubscriptionStatus . Disabled ,
363
+ ActiveDirectoryTenantId = "B59BE059-5E3F-463B-8C1A-831A29819B52"
364
+ } ;
365
+
366
+ var deletedTenantIdrdfeSubscription = new RDFESubscription
367
+ {
368
+ SubscriptionId = "16E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E" ,
369
+ SubscriptionName = "RdfeSub1" ,
370
+ SubscriptionStatus = Microsoft . WindowsAzure . Subscriptions . Models . SubscriptionStatus . Deleted ,
371
+ ActiveDirectoryTenantId = "B59BE059-5E3F-463B-8C1A-831A29819B52"
372
+ } ;
373
+
374
+ var deletingTenantIdrdfeSubscription = new RDFESubscription
375
+ {
376
+ SubscriptionId = "16E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E" ,
377
+ SubscriptionName = "RdfeSub1" ,
378
+ SubscriptionStatus = Microsoft . WindowsAzure . Subscriptions . Models . SubscriptionStatus . Deleting ,
379
+ ActiveDirectoryTenantId = "B59BE059-5E3F-463B-8C1A-831A29819B52"
380
+ } ;
381
+
382
+ SetMocks (
383
+ new [ ] { rdfeSubscription1 , emptyTenantIdrdfeSubscription , disabledTenantIdrdfeSubscription , deletedTenantIdrdfeSubscription , deletingTenantIdrdfeSubscription } . ToList ( ) ,
384
+ new [ ] { csmSubscription1 } . ToList ( ) ) ;
385
+ MemoryDataStore dataStore = new MemoryDataStore ( ) ;
386
+ dataStore . VirtualStore [ oldProfileDataPath ] = oldProfileData ;
387
+ AzureSession . DataStore = dataStore ;
388
+ currentProfile = new AzureSMProfile ( Path . Combine ( AzureSession . ProfileDirectory , AzureSession . ProfileFile ) ) ;
389
+ ProfileClient client = new ProfileClient ( currentProfile ) ;
390
+
391
+ var account = client . AddAccountAndLoadSubscriptions (
392
+ new AzureAccount { Id = "test" , Type = AzureAccount . AccountType . User } ,
393
+ AzureEnvironment . PublicEnvironments [ EnvironmentName . AzureCloud ] ,
394
+ null ) ;
395
+
396
+ Assert . Equal ( "test" , account . Id ) ;
397
+ Assert . Equal ( 1 , account . GetSubscriptions ( client . Profile ) . Count ) ;
398
+ Assert . True ( account . GetSubscriptions ( client . Profile ) . Any ( s => s . Id == new Guid ( rdfeSubscription1 . SubscriptionId ) ) ) ;
399
+ Assert . False ( account . GetSubscriptions ( client . Profile ) . Any ( s => s . Id == new Guid ( csmSubscription1 . SubscriptionId ) ) ) ;
400
+ }
401
+
347
402
[ Fact ]
348
403
public void AddAzureAccountReturnsAccountWithAllSubscriptionsInCsmMode ( )
349
404
{
@@ -1388,7 +1443,7 @@ private void SetMockData()
1388
1443
{
1389
1444
SubscriptionId = "26E3F6FD-A3AA-439A-8FC4-1F5C41D2AD1E" ,
1390
1445
SubscriptionName = "RdfeSub2" ,
1391
- SubscriptionStatus = Microsoft . WindowsAzure . Subscriptions . Models . SubscriptionStatus . Active ,
1446
+ SubscriptionStatus = Microsoft . WindowsAzure . Subscriptions . Models . SubscriptionStatus . Warned ,
1392
1447
ActiveDirectoryTenantId = "Common"
1393
1448
} ;
1394
1449
guestRdfeSubscription = new RDFESubscription
0 commit comments