1+ using System . IO . Abstractions ;
12using GitVersion . Configuration ;
23using GitVersion . Core . Tests . Helpers ;
34using GitVersion . Helpers ;
@@ -283,7 +284,7 @@ public void UpdateAssemblyInfoWithFilename()
283284 using var repo = new EmptyRepositoryFixture ( ) ;
284285
285286 var assemblyFile = PathHelper . Combine ( repo . RepositoryPath , "CommonAssemblyInfo.cs" ) ;
286- using var file = File . Create ( assemblyFile ) ;
287+ using var file = this . fileSystem . File . Create ( assemblyFile ) ;
287288
288289 var arguments = this . argumentParser . ParseArguments ( $ "-targetpath { repo . RepositoryPath } -updateAssemblyInfo CommonAssemblyInfo.cs") ;
289290 arguments . UpdateAssemblyInfo . ShouldBe ( true ) ;
@@ -297,10 +298,10 @@ public void UpdateAssemblyInfoWithMultipleFilenames()
297298 using var repo = new EmptyRepositoryFixture ( ) ;
298299
299300 var assemblyFile1 = PathHelper . Combine ( repo . RepositoryPath , "CommonAssemblyInfo.cs" ) ;
300- using var file = File . Create ( assemblyFile1 ) ;
301+ using var file = this . fileSystem . File . Create ( assemblyFile1 ) ;
301302
302303 var assemblyFile2 = PathHelper . Combine ( repo . RepositoryPath , "VersionAssemblyInfo.cs" ) ;
303- using var file2 = File . Create ( assemblyFile2 ) ;
304+ using var file2 = this . fileSystem . File . Create ( assemblyFile2 ) ;
304305
305306 var arguments = this . argumentParser . ParseArguments ( $ "-targetpath { repo . RepositoryPath } -updateAssemblyInfo CommonAssemblyInfo.cs VersionAssemblyInfo.cs") ;
306307 arguments . UpdateAssemblyInfo . ShouldBe ( true ) ;
@@ -315,10 +316,10 @@ public void UpdateProjectFilesWithMultipleFilenames()
315316 using var repo = new EmptyRepositoryFixture ( ) ;
316317
317318 var assemblyFile1 = PathHelper . Combine ( repo . RepositoryPath , "CommonAssemblyInfo.csproj" ) ;
318- using var file = File . Create ( assemblyFile1 ) ;
319+ using var file = this . fileSystem . File . Create ( assemblyFile1 ) ;
319320
320321 var assemblyFile2 = PathHelper . Combine ( repo . RepositoryPath , "VersionAssemblyInfo.csproj" ) ;
321- using var file2 = File . Create ( assemblyFile2 ) ;
322+ using var file2 = this . fileSystem . File . Create ( assemblyFile2 ) ;
322323
323324 var arguments = this . argumentParser . ParseArguments ( $ "-targetpath { repo . RepositoryPath } -updateProjectFiles CommonAssemblyInfo.csproj VersionAssemblyInfo.csproj") ;
324325 arguments . UpdateProjectFiles . ShouldBe ( true ) ;
@@ -333,16 +334,16 @@ public void UpdateAssemblyInfoWithMultipleFilenamesMatchingGlobbing()
333334 using var repo = new EmptyRepositoryFixture ( ) ;
334335
335336 var assemblyFile1 = PathHelper . Combine ( repo . RepositoryPath , "CommonAssemblyInfo.cs" ) ;
336- using var file = File . Create ( assemblyFile1 ) ;
337+ using var file = this . fileSystem . File . Create ( assemblyFile1 ) ;
337338
338339 var assemblyFile2 = PathHelper . Combine ( repo . RepositoryPath , "VersionAssemblyInfo.cs" ) ;
339- using var file2 = File . Create ( assemblyFile2 ) ;
340+ using var file2 = this . fileSystem . File . Create ( assemblyFile2 ) ;
340341
341342 var subdir = PathHelper . Combine ( repo . RepositoryPath , "subdir" ) ;
342343
343- this . fileSystem . CreateDirectory ( subdir ) ;
344+ this . fileSystem . Directory . CreateDirectory ( subdir ) ;
344345 var assemblyFile3 = PathHelper . Combine ( subdir , "LocalAssemblyInfo.cs" ) ;
345- using var file3 = File . Create ( assemblyFile3 ) ;
346+ using var file3 = this . fileSystem . File . Create ( assemblyFile3 ) ;
346347
347348 var arguments = this . argumentParser . ParseArguments ( $ "-targetpath { repo . RepositoryPath } -updateAssemblyInfo **/*AssemblyInfo.cs") ;
348349 arguments . UpdateAssemblyInfo . ShouldBe ( true ) ;
@@ -358,10 +359,10 @@ public void UpdateAssemblyInfoWithRelativeFilename()
358359 using var repo = new EmptyRepositoryFixture ( ) ;
359360
360361 var assemblyFile = PathHelper . Combine ( repo . RepositoryPath , "CommonAssemblyInfo.cs" ) ;
361- using var file = File . Create ( assemblyFile ) ;
362+ using var file = this . fileSystem . File . Create ( assemblyFile ) ;
362363
363364 var targetPath = PathHelper . Combine ( repo . RepositoryPath , "subdir1" , "subdir2" ) ;
364- this . fileSystem . CreateDirectory ( targetPath ) ;
365+ this . fileSystem . Directory . CreateDirectory ( targetPath ) ;
365366
366367 var arguments = this . argumentParser . ParseArguments ( $ "-targetpath { targetPath } -updateAssemblyInfo ..\\ ..\\ CommonAssemblyInfo.cs") ;
367368 arguments . UpdateAssemblyInfo . ShouldBe ( true ) ;
@@ -765,9 +766,9 @@ public void ThrowIfConfigurationFileDoesNotExist(string configFile) =>
765766 public void EnsureConfigurationFileIsSet ( )
766767 {
767768 var configFile = PathHelper . GetTempPath ( ) + Guid . NewGuid ( ) + ".yaml" ;
768- File . WriteAllText ( configFile , "next-version: 1.0.0" ) ;
769+ this . fileSystem . File . WriteAllText ( configFile , "next-version: 1.0.0" ) ;
769770 var arguments = this . argumentParser . ParseArguments ( $ "-config { configFile } ") ;
770771 arguments . ConfigurationFile . ShouldBe ( configFile ) ;
771- File . Delete ( configFile ) ;
772+ this . fileSystem . File . Delete ( configFile ) ;
772773 }
773774}
0 commit comments