@@ -61,12 +61,18 @@ public void AddsAzureEnvironment()
61
61
{
62
62
CommandRuntime = commandRuntimeMock . Object ,
63
63
Name = "Katal" ,
64
- PublishSettingsFileUrl = "http://microsoft.com" ,
65
- ServiceEndpoint = "https://endpoint.net" ,
66
- ManagementPortalUrl = "http://management.portal.url" ,
67
- StorageEndpoint = "http://endpoint.net" ,
68
- GalleryEndpoint = "http://galleryendpoint.com" ,
69
64
} ;
65
+ var dict = new Dictionary < string , object >
66
+ {
67
+ { "PublishSettingsFileUrl" , "http://microsoft.com" } ,
68
+ { "ServiceEndpoint" , "https://endpoint.net" } ,
69
+ { "ManagementPortalUrl" , "http://management.portal.url" } ,
70
+ { "StorageEndpoint" , "http://endpoint.net" } ,
71
+ { "GalleryEndpoint" , "http://galleryendpoint.com" } ,
72
+
73
+ } ;
74
+
75
+ cmdlet . SetBoundParameters ( dict ) ;
70
76
cmdlet . InvokeBeginProcessing ( ) ;
71
77
cmdlet . ExecuteCmdlet ( ) ;
72
78
cmdlet . InvokeEndProcessing ( ) ;
@@ -75,9 +81,9 @@ public void AddsAzureEnvironment()
75
81
var profileClient = new RMProfileClient ( AzureRmProfileProvider . Instance . GetProfile < AzureRmProfile > ( ) ) ;
76
82
IAzureEnvironment env = AzureRmProfileProvider . Instance . Profile . Environments . First ( ( e ) => string . Equals ( e . Name , "KaTaL" , StringComparison . OrdinalIgnoreCase ) ) ;
77
83
Assert . Equal ( env . Name , cmdlet . Name ) ;
78
- Assert . Equal ( env . GetEndpoint ( AzureEnvironment . Endpoint . PublishSettingsFileUrl ) , cmdlet . PublishSettingsFileUrl ) ;
79
- Assert . Equal ( env . GetEndpoint ( AzureEnvironment . Endpoint . ServiceManagement ) , cmdlet . ServiceEndpoint ) ;
80
- Assert . Equal ( env . GetEndpoint ( AzureEnvironment . Endpoint . ManagementPortalUrl ) , cmdlet . ManagementPortalUrl ) ;
84
+ Assert . Equal ( env . GetEndpoint ( AzureEnvironment . Endpoint . PublishSettingsFileUrl ) , dict [ " PublishSettingsFileUrl" ] ) ;
85
+ Assert . Equal ( env . GetEndpoint ( AzureEnvironment . Endpoint . ServiceManagement ) , dict [ " ServiceEndpoint" ] ) ;
86
+ Assert . Equal ( env . GetEndpoint ( AzureEnvironment . Endpoint . ManagementPortalUrl ) , dict [ " ManagementPortalUrl" ] ) ;
81
87
Assert . Equal ( env . GetEndpoint ( AzureEnvironment . Endpoint . Gallery ) , "http://galleryendpoint.com" ) ;
82
88
}
83
89
@@ -106,10 +112,11 @@ public void AddsAzureEnvironmentUsingAPublicRMEndpoint()
106
112
107
113
commandRuntimeMock . Verify ( f => f . WriteObject ( It . IsAny < PSAzureEnvironment > ( ) ) , Times . Once ( ) ) ;
108
114
IAzureEnvironment env = AzureRmProfileProvider . Instance . Profile . GetEnvironment ( "Katal" ) ;
115
+ var oracle = AzureEnvironment . PublicEnvironments [ EnvironmentName . AzureCloud ] ;
109
116
Assert . Equal ( env . Name , cmdlet . Name ) ;
110
- Assert . Equal ( env . GetEndpoint ( AzureEnvironment . Endpoint . ResourceManager ) , cmdlet . ResourceManagerEndpoint ) ;
111
- Assert . Equal ( env . GetEndpoint ( AzureEnvironment . Endpoint . ActiveDirectory ) , cmdlet . ActiveDirectoryEndpoint ) ;
112
- Assert . Equal ( env . GetEndpoint ( AzureEnvironment . Endpoint . ActiveDirectoryServiceEndpointResourceId ) , cmdlet . ActiveDirectoryServiceEndpointResourceId ) ;
117
+ Assert . Equal ( oracle . ResourceManagerUrl , env . GetEndpoint ( AzureEnvironment . Endpoint . ResourceManager ) ) ;
118
+ Assert . Equal ( oracle . ActiveDirectoryAuthority , env . GetEndpoint ( AzureEnvironment . Endpoint . ActiveDirectory ) ) ;
119
+ Assert . Equal ( oracle . ActiveDirectoryServiceEndpointResourceId , env . GetEndpoint ( AzureEnvironment . Endpoint . ActiveDirectoryServiceEndpointResourceId ) ) ;
113
120
envHelperMock . Verify ( f => f . RetrieveDomain ( It . IsAny < string > ( ) ) , Times . Never ) ;
114
121
envHelperMock . Verify ( f => f . RetrieveMetaDataEndpoints ( It . IsAny < string > ( ) ) , Times . Never ) ;
115
122
}
@@ -151,10 +158,10 @@ public void AddsAzureEnvironmentUsingARMEndpoint()
151
158
var profileClient = new RMProfileClient ( AzureRmProfileProvider . Instance . GetProfile < AzureRmProfile > ( ) ) ;
152
159
IAzureEnvironment env = AzureRmProfileProvider . Instance . Profile . GetEnvironment ( "Stack" ) ;
153
160
Assert . Equal ( env . Name , cmdlet . Name ) ;
154
- Assert . Equal ( env . GetEndpoint ( AzureEnvironment . Endpoint . ResourceManager ) , cmdlet . ResourceManagerEndpoint ) ;
155
- Assert . Equal ( env . GetEndpoint ( AzureEnvironment . Endpoint . ActiveDirectory ) , cmdlet . ActiveDirectoryEndpoint ) ;
156
- Assert . Equal ( env . GetEndpoint ( AzureEnvironment . Endpoint . ActiveDirectoryServiceEndpointResourceId ) , cmdlet . ActiveDirectoryServiceEndpointResourceId ) ;
157
- Assert . Equal ( env . GetEndpoint ( AzureEnvironment . Endpoint . GraphEndpointResourceId ) , "https://graphendpoint" ) ;
161
+ Assert . Equal ( cmdlet . ARMEndpoint , env . GetEndpoint ( AzureEnvironment . Endpoint . ResourceManager ) ) ;
162
+ Assert . Equal ( "https://loginendpoint/" , env . GetEndpoint ( AzureEnvironment . Endpoint . ActiveDirectory ) ) ;
163
+ Assert . Equal ( "audience1" , env . GetEndpoint ( AzureEnvironment . Endpoint . ActiveDirectoryServiceEndpointResourceId ) ) ;
164
+ Assert . Equal ( "https://graphendpoint" , env . GetEndpoint ( AzureEnvironment . Endpoint . GraphEndpointResourceId ) ) ;
158
165
envHelperMock . Verify ( f => f . RetrieveDomain ( It . IsAny < string > ( ) ) , Times . Once ) ;
159
166
envHelperMock . Verify ( f => f . RetrieveMetaDataEndpoints ( It . IsAny < string > ( ) ) , Times . Once ) ;
160
167
}
@@ -173,6 +180,11 @@ public void AddsEnvironmentMultipleTimes()
173
180
EnableAdfsAuthentication = true ,
174
181
} ;
175
182
183
+ var dict = new Dictionary < string , object > ( ) ;
184
+ dict [ "PublishSettingsFileUrl" ] = "http://microsoft.com" ;
185
+ dict [ "EnableAdfsAuthentication" ] = true ;
186
+ cmdlet . SetBoundParameters ( dict ) ;
187
+
176
188
cmdlet . InvokeBeginProcessing ( ) ;
177
189
cmdlet . ExecuteCmdlet ( ) ;
178
190
cmdlet . InvokeEndProcessing ( ) ;
@@ -191,6 +203,10 @@ public void AddsEnvironmentMultipleTimes()
191
203
EnableAdfsAuthentication = true ,
192
204
} ;
193
205
206
+ dict . Clear ( ) ;
207
+ dict [ "EnableAdfsAuthentication" ] = true ;
208
+ cmdlet2 . SetBoundParameters ( dict ) ;
209
+
194
210
cmdlet2 . InvokeBeginProcessing ( ) ;
195
211
cmdlet2 . ExecuteCmdlet ( ) ;
196
212
cmdlet2 . InvokeEndProcessing ( ) ;
@@ -206,6 +222,8 @@ public void AddsEnvironmentMultipleTimes()
206
222
CommandRuntime = commandRuntimeMock . Object ,
207
223
Name = "Katal" ,
208
224
} ;
225
+ dict . Clear ( ) ;
226
+ cmdlet3 . SetBoundParameters ( dict ) ;
209
227
210
228
cmdlet3 . InvokeBeginProcessing ( ) ;
211
229
cmdlet3 . ExecuteCmdlet ( ) ;
@@ -227,10 +245,13 @@ public void AddsEnvironmentWithMinimumInformation()
227
245
{
228
246
CommandRuntime = commandRuntimeMock . Object ,
229
247
Name = "Katal" ,
230
- PublishSettingsFileUrl = "http://microsoft.com" ,
231
- EnableAdfsAuthentication = true ,
248
+ EnableAdfsAuthentication = true
232
249
} ;
233
250
251
+ var dict = new Dictionary < string , object > ( ) ;
252
+ dict [ "EnableAdfsAuthentication" ] = true ;
253
+ dict [ "PublishSettingsFileUrl" ] = "http://microsoft.com" ;
254
+ cmdlet . SetBoundParameters ( dict ) ;
234
255
cmdlet . InvokeBeginProcessing ( ) ;
235
256
cmdlet . ExecuteCmdlet ( ) ;
236
257
cmdlet . InvokeEndProcessing ( ) ;
@@ -239,7 +260,7 @@ public void AddsEnvironmentWithMinimumInformation()
239
260
IAzureEnvironment env = AzureRmProfileProvider . Instance . Profile . GetEnvironment ( "KaTaL" ) ;
240
261
Assert . Equal ( env . Name , cmdlet . Name ) ;
241
262
Assert . True ( env . OnPremise ) ;
242
- Assert . Equal ( env . GetEndpoint ( AzureEnvironment . Endpoint . PublishSettingsFileUrl ) , cmdlet . PublishSettingsFileUrl ) ;
263
+ Assert . Equal ( "http://microsoft.com" , env . GetEndpoint ( AzureEnvironment . Endpoint . PublishSettingsFileUrl ) ) ;
243
264
}
244
265
#if ! NETSTANDARD
245
266
[ Fact ]
@@ -258,6 +279,13 @@ public void IgnoresAddingDuplicatedEnvironment()
258
279
ManagementPortalUrl = "https://management.portal.url" ,
259
280
StorageEndpoint = "http://endpoint.net"
260
281
} ;
282
+
283
+ var dict = new Dictionary < string , object > ( ) ;
284
+ dict [ "PublishSettingsFileUrl" ] = "http://microsoft.com" ;
285
+ dict [ "ServiceEndpoint" ] = "http://endpoint.net" ;
286
+ dict [ "ManagementPortalUrl" ] = "https://management.portal.url" ;
287
+ dict [ "StorageEndpoint" ] = "http://endpoint.net" ;
288
+ cmdlet . SetBoundParameters ( dict ) ;
261
289
cmdlet . InvokeBeginProcessing ( ) ;
262
290
cmdlet . ExecuteCmdlet ( ) ;
263
291
cmdlet . InvokeEndProcessing ( ) ;
@@ -268,7 +296,7 @@ public void IgnoresAddingDuplicatedEnvironment()
268
296
cmdlet . Name = "kAtAl" ;
269
297
cmdlet . ExecuteCmdlet ( ) ;
270
298
IAzureEnvironment env = AzureRmProfileProvider . Instance . Profile . GetEnvironment ( "KaTaL" ) ;
271
- Assert . Equal ( env . Name , cmdlet . Name ) ;
299
+ Assert . Equal ( "Katal" , env . Name ) ;
272
300
}
273
301
#endif
274
302
[ Fact ]
@@ -345,13 +373,32 @@ public void CanCreateEnvironmentWithAllProperties()
345
373
GraphAudience = "GaraphAudience"
346
374
} ;
347
375
376
+ var dict = new Dictionary < string , object > ( ) ;
377
+ dict [ "ActiveDirectoryEndpoint" ] = "https://ActiveDirectoryEndpoint" ;
378
+ dict [ "AdTenant" ] = "AdTenant" ;
379
+ dict [ "AzureKeyVaultDnsSuffix" ] = "AzureKeyVaultDnsSuffix" ;
380
+ dict [ "ActiveDirectoryServiceEndpointResourceId" ] = "https://ActiveDirectoryServiceEndpointResourceId" ;
381
+ dict [ "AzureKeyVaultServiceEndpointResourceId" ] = "https://AzureKeyVaultServiceEndpointResourceId" ;
382
+ dict [ "EnableAdfsAuthentication" ] = true ;
383
+ dict [ "GalleryEndpoint" ] = "https://GalleryEndpoint" ;
384
+ dict [ "GraphEndpoint" ] = "https://GraphEndpoint" ;
385
+ dict [ "ManagementPortalUrl" ] = "https://ManagementPortalUrl" ;
386
+ dict [ "PublishSettingsFileUrl" ] = "https://PublishSettingsFileUrl" ;
387
+ dict [ "ResourceManagerEndpoint" ] = "https://ResourceManagerEndpoint" ;
388
+ dict [ "ServiceEndpoint" ] = "https://ServiceEndpoint" ;
389
+ dict [ "StorageEndpoint" ] = "https://StorageEndpoint" ;
390
+ dict [ "SqlDatabaseDnsSuffix" ] = "SqlDatabaseDnsSuffix" ;
391
+ dict [ "TrafficManagerDnsSuffix" ] = "TrafficManagerDnsSuffix" ;
392
+ dict [ "GraphAudience" ] = "GaraphAudience" ;
393
+ cmdlet . SetBoundParameters ( dict ) ;
394
+
348
395
cmdlet . InvokeBeginProcessing ( ) ;
349
396
cmdlet . ExecuteCmdlet ( ) ;
350
397
cmdlet . InvokeEndProcessing ( ) ;
351
398
Assert . Equal ( cmdlet . Name , actual . Name ) ;
352
399
Assert . Equal ( cmdlet . EnableAdfsAuthentication . ToBool ( ) , actual . EnableAdfsAuthentication ) ;
353
400
Assert . Equal ( cmdlet . ActiveDirectoryEndpoint + "/" , actual . ActiveDirectoryAuthority , StringComparer . OrdinalIgnoreCase ) ;
354
- Assert . Equal ( cmdlet . ActiveDirectoryServiceEndpointResourceId ,
401
+ Assert . Equal ( cmdlet . ActiveDirectoryServiceEndpointResourceId + "/" ,
355
402
actual . ActiveDirectoryServiceEndpointResourceId ) ;
356
403
Assert . Equal ( cmdlet . AdTenant , actual . AdTenant ) ;
357
404
Assert . Equal ( cmdlet . AzureKeyVaultDnsSuffix , actual . AzureKeyVaultDnsSuffix ) ;
@@ -408,6 +455,9 @@ public void CreateEnvironmentWithTrailingSlashInActiveDirectory()
408
455
ActiveDirectoryEndpoint = "https://ActiveDirectoryEndpoint/"
409
456
} ;
410
457
458
+ var dict = new Dictionary < string , object > ( ) ;
459
+ dict [ "ActiveDirectoryEndpoint" ] = "https://ActiveDirectoryEndpoint/" ;
460
+ cmdlet . SetBoundParameters ( dict ) ;
411
461
SetupConfirmation ( commandRuntimeMock ) ;
412
462
cmdlet . InvokeBeginProcessing ( ) ;
413
463
cmdlet . ExecuteCmdlet ( ) ;
0 commit comments