@@ -178,7 +178,9 @@ public void ApplicationPackageReferencesAreSentOnATask()
178
178
cmdlet . ExecuteCmdlet ( ) ;
179
179
}
180
180
181
- private void ExitConditionsAreSentToService ( )
181
+ [ Fact ]
182
+ [ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
183
+ public void ExitConditionsAreSentToService ( )
182
184
{
183
185
BatchAccountContext context = BatchTestHelpers . CreateBatchContextWithKeys ( ) ;
184
186
cmdlet . BatchContext = context ;
@@ -317,11 +319,65 @@ public void NewBatchTaskCollectionParametersTest()
317
319
318
320
Assert . Throws < ArgumentNullException > ( ( ) => cmdlet . ExecuteCmdlet ( ) ) ;
319
321
320
- string [ ] taskIds = new [ ] { "simple1" , "simple2" } ;
321
- PSCloudTask expected1 = new PSCloudTask ( taskIds [ 0 ] , commandLine ) ;
322
- PSCloudTask expected2 = new PSCloudTask ( taskIds [ 1 ] , commandLine ) ;
322
+ const string pattern = @"**\*.txt" ;
323
+ const string containerUrl = "containerUrl" ;
324
+ const string path = "path" ;
325
+ const OutputFileUploadCondition uploadCondition = OutputFileUploadCondition . TaskCompletion ;
323
326
324
- cmdlet . Tasks = new PSCloudTask [ ] { expected1 , expected2 } ;
327
+ string [ ] taskIds = new [ ] { "simple1" , "simple2" } ;
328
+ PSCloudTask [ ] tasks = taskIds . Select (
329
+ id => new PSCloudTask ( id , commandLine )
330
+ {
331
+ ResourceFiles = new [ ]
332
+ {
333
+ new PSResourceFile ( ResourceFile . FromUrl ( "anotherFile.txt" , "https://another.blob" ) )
334
+ } ,
335
+ OutputFiles = new [ ]
336
+ {
337
+ new PSOutputFile (
338
+ pattern ,
339
+ new PSOutputFileDestination ( new PSOutputFileBlobContainerDestination ( containerUrl , path ) ) ,
340
+ new PSOutputFileUploadOptions ( uploadCondition ) )
341
+ } ,
342
+ ApplicationPackageReferences = new [ ]
343
+ {
344
+ new PSApplicationPackageReference
345
+ {
346
+ ApplicationId = "1" ,
347
+ Version = "foo"
348
+ }
349
+ } ,
350
+ ExitConditions = new PSExitConditions ( )
351
+ {
352
+ ExitCodeRanges = new List < PSExitCodeRangeMapping >
353
+ {
354
+ new PSExitCodeRangeMapping (
355
+ 5 ,
356
+ 10 ,
357
+ new PSExitOptions
358
+ {
359
+ DependencyAction = Azure . Batch . Common . DependencyAction . Block
360
+ } )
361
+
362
+ } ,
363
+ ExitCodes = new List < PSExitCodeMapping >
364
+ {
365
+ new PSExitCodeMapping (
366
+ 11 ,
367
+ new PSExitOptions
368
+ {
369
+ DependencyAction = Azure . Batch . Common . DependencyAction . Block
370
+ } )
371
+
372
+ } ,
373
+ Default = new PSExitOptions
374
+ {
375
+ DependencyAction = Azure . Batch . Common . DependencyAction . Satisfy
376
+ }
377
+ }
378
+ } ) . ToArray ( ) ;
379
+
380
+ cmdlet . Tasks = tasks ;
325
381
326
382
IList < TaskAddParameter > requestCollection = null ;
327
383
@@ -349,6 +405,18 @@ public void NewBatchTaskCollectionParametersTest()
349
405
foreach ( var task in requestCollection )
350
406
{
351
407
Assert . Contains ( task . Id , taskIds ) ;
408
+ Assert . NotNull ( task . ResourceFiles ) ;
409
+ Assert . NotEmpty ( task . ResourceFiles ) ;
410
+ Assert . NotNull ( task . OutputFiles ) ;
411
+ Assert . NotEmpty ( task . OutputFiles ) ;
412
+ Assert . NotNull ( task . ApplicationPackageReferences ) ;
413
+ Assert . NotEmpty ( task . ApplicationPackageReferences ) ;
414
+
415
+ Assert . NotNull ( task . ExitConditions . ExitCodeRanges ) ;
416
+ Assert . NotEmpty ( task . ExitConditions . ExitCodeRanges ) ;
417
+ Assert . NotNull ( task . ExitConditions . ExitCodes ) ;
418
+ Assert . NotEmpty ( task . ExitConditions . ExitCodes ) ;
419
+ Assert . NotNull ( task . ExitConditions . DefaultProperty ) ;
352
420
}
353
421
}
354
422
0 commit comments