@@ -19,7 +19,12 @@ public class ArgumentParserTests : TestBase
19
19
[ SetUp ]
20
20
public void SetUp ( )
21
21
{
22
- argumentParser = GetArgumentParser ( ) ;
22
+ var sp = ConfigureServices ( services =>
23
+ {
24
+ services . AddSingleton < IArgumentParser , ArgumentParser > ( ) ;
25
+ services . AddSingleton < IGlobbingResolver , GlobbingResolver > ( ) ;
26
+ } ) ;
27
+ argumentParser = sp . GetService < IArgumentParser > ( ) ;
23
28
}
24
29
25
30
[ Test ]
@@ -284,6 +289,30 @@ public void UpdateAssemblyInfoWithMultipleFilenames()
284
289
arguments . UpdateAssemblyInfoFileName . ShouldContain ( x => Path . GetFileName ( x ) . Equals ( "VersionAssemblyInfo.cs" ) ) ;
285
290
}
286
291
292
+ [ Test ]
293
+ public void UpdateAssemblyInfoWithMultipleFilenamesMatchingGlobbing ( )
294
+ {
295
+ using var repo = new EmptyRepositoryFixture ( ) ;
296
+
297
+ var assemblyFile1 = Path . Combine ( repo . RepositoryPath , "CommonAssemblyInfo.cs" ) ;
298
+ using var file = File . Create ( assemblyFile1 ) ;
299
+
300
+ var assemblyFile2 = Path . Combine ( repo . RepositoryPath , "VersionAssemblyInfo.cs" ) ;
301
+ using var file2 = File . Create ( assemblyFile2 ) ;
302
+
303
+ var subdir = Path . Combine ( repo . RepositoryPath , "subdir" ) ;
304
+ Directory . CreateDirectory ( subdir ) ;
305
+ var assemblyFile3 = Path . Combine ( subdir , "LocalAssemblyInfo.cs" ) ;
306
+ using var file3 = File . Create ( assemblyFile3 ) ;
307
+
308
+ var arguments = argumentParser . ParseArguments ( $ "-targetpath { repo . RepositoryPath } -updateAssemblyInfo **/*AssemblyInfo.cs") ;
309
+ arguments . UpdateAssemblyInfo . ShouldBe ( true ) ;
310
+ arguments . UpdateAssemblyInfoFileName . Count . ShouldBe ( 3 ) ;
311
+ arguments . UpdateAssemblyInfoFileName . ShouldContain ( x => Path . GetFileName ( x ) . Equals ( "CommonAssemblyInfo.cs" ) ) ;
312
+ arguments . UpdateAssemblyInfoFileName . ShouldContain ( x => Path . GetFileName ( x ) . Equals ( "VersionAssemblyInfo.cs" ) ) ;
313
+ arguments . UpdateAssemblyInfoFileName . ShouldContain ( x => Path . GetFileName ( x ) . Equals ( "LocalAssemblyInfo.cs" ) ) ;
314
+ }
315
+
287
316
[ Test ]
288
317
public void UpdateAssemblyInfoWithRelativeFilename ( )
289
318
{
@@ -487,22 +516,5 @@ public void CheckVerbosityParsing(string command, bool shouldThrow, Verbosity ex
487
516
arguments . Verbosity . ShouldBe ( expectedVerbosity ) ;
488
517
}
489
518
}
490
-
491
- private static IArgumentParser GetArgumentParser ( IGlobbingResolver globbingResolver = null )
492
- {
493
- var sp = ConfigureServices ( services =>
494
- {
495
- services . AddSingleton < IArgumentParser , ArgumentParser > ( ) ;
496
- if ( globbingResolver != null )
497
- {
498
- services . AddSingleton ( globbingResolver ) ;
499
- }
500
- else
501
- {
502
- services . AddSingleton < IGlobbingResolver , GlobbingResolver > ( ) ;
503
- }
504
- } ) ;
505
- return sp . GetService < IArgumentParser > ( ) ;
506
- }
507
519
}
508
520
}
0 commit comments