@@ -41,7 +41,7 @@ public void OverwritesDefaultsWithProvidedConfig()
4141 increment: Major
4242 mode: ContinuousDelivery
4343 label: dev" ;
44- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
44+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
4545 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
4646
4747 configuration . NextVersion . ShouldBe ( "2.0.0" ) ;
@@ -59,7 +59,8 @@ public void OverwritesDefaultsWithProvidedConfig()
5959 public void CombineVersionStrategyConfigNextAndTaggedCommit ( )
6060 {
6161 // Arrange
62- fileSystem . SetupConfigFile ( "strategies: [ConfiguredNextVersion, TaggedCommit]" , this . repoPath ) ;
62+ const string text = "strategies: [ConfiguredNextVersion, TaggedCommit]" ;
63+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
6364
6465 // Act
6566 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
@@ -76,7 +77,7 @@ public void CanRemoveLabel()
7677branches:
7778 release:
7879 label: """"" ;
79- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
80+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
8081 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
8182
8283 configuration . NextVersion . ShouldBe ( "2.0.0" ) ;
@@ -91,7 +92,7 @@ public void RegexIsRequired()
9192branches:
9293 bug:
9394 label: bugfix" ;
94- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
95+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
9596 var ex = Should . Throw < ConfigurationException > ( ( ) => this . configurationProvider . ProvideForDirectory ( this . repoPath ) ) ;
9697 ex . Message . ShouldBe ( $ "Branch configuration 'bug' is missing required configuration 'regex'{ PathHelper . NewLine } " +
9798 "See https://gitversion.net/docs/reference/configuration for more info" ) ;
@@ -106,7 +107,7 @@ public void SourceBranchesValidationShouldFailWhenMatchingBranchConfigurationIsM
106107 regex: 'bug[/-]'
107108 label: bugfix
108109 source-branches: [notconfigured]" ;
109- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
110+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
110111 var ex = Should . Throw < ConfigurationException > ( ( ) => this . configurationProvider . ProvideForDirectory ( this . repoPath ) ) ;
111112 ex . Message . ShouldBe ( $ "Branch configuration 'bug' defines these 'source-branches' that are not configured: '[notconfigured]'{ PathHelper . NewLine } " +
112113 "See https://gitversion.net/docs/reference/configuration for more info" ) ;
@@ -123,7 +124,7 @@ public void SourceBranchesValidationShouldSucceedForWellKnownBranches(string wel
123124 regex: 'bug[/-]'
124125 label: bugfix
125126 source-branches: [{ wellKnownBranchKey } ]" ;
126- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
127+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
127128 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
128129
129130 configuration . Branches [ "bug" ] . SourceBranches . ShouldBe ( new List < string > { wellKnownBranchKey } ) ;
@@ -139,7 +140,7 @@ public void CanProvideConfigForNewBranch()
139140 regex: 'bug[/-]'
140141 label: bugfix
141142 source-branches: []" ;
142- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
143+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
143144 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
144145
145146 configuration . Branches [ "bug" ] . RegularExpression . ShouldBe ( "bug[/-]" ) ;
@@ -150,7 +151,7 @@ public void CanProvideConfigForNewBranch()
150151 public void NextVersionCanBeInteger ( )
151152 {
152153 const string text = "next-version: 2" ;
153- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
154+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
154155 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
155156
156157 configuration . NextVersion . ShouldBe ( "2.0" ) ;
@@ -160,7 +161,7 @@ public void NextVersionCanBeInteger()
160161 public void NextVersionCanHaveEnormousMinorVersion ( )
161162 {
162163 const string text = "next-version: 2.118998723" ;
163- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
164+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
164165 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
165166
166167 configuration . NextVersion . ShouldBe ( "2.118998723" ) ;
@@ -170,7 +171,7 @@ public void NextVersionCanHaveEnormousMinorVersion()
170171 public void NextVersionCanHavePatch ( )
171172 {
172173 const string text = "next-version: 2.12.654651698" ;
173- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
174+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
174175 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
175176
176177 configuration . NextVersion . ShouldBe ( "2.12.654651698" ) ;
@@ -193,7 +194,7 @@ public void CanUpdateAssemblyInformationalVersioningScheme()
193194assembly-file-versioning-scheme: MajorMinorPatch
194195assembly-informational-format: '{NugetVersion}'" ;
195196
196- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
197+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
197198
198199 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
199200 configuration . AssemblyVersioningScheme . ShouldBe ( AssemblyVersioningScheme . MajorMinor ) ;
@@ -209,7 +210,7 @@ public void CanUpdateAssemblyInformationalVersioningSchemeWithMultipleVariables(
209210assembly-file-versioning-scheme: MajorMinorPatch
210211assembly-informational-format: '{Major}.{Minor}.{Patch}'" ;
211212
212- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
213+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
213214
214215 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
215216 configuration . AssemblyVersioningScheme . ShouldBe ( AssemblyVersioningScheme . MajorMinor ) ;
@@ -227,7 +228,7 @@ public void CanUpdateAssemblyInformationalVersioningSchemeWithFullSemVer()
227228next-version: 5.3.0
228229branches: {}" ;
229230
230- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
231+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
231232
232233 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
233234 configuration . AssemblyVersioningScheme . ShouldBe ( AssemblyVersioningScheme . MajorMinorPatch ) ;
@@ -239,7 +240,7 @@ public void CanUpdateAssemblyInformationalVersioningSchemeWithFullSemVer()
239240 public void CanReadDefaultDocument ( )
240241 {
241242 const string text = "" ;
242- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
243+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
243244 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
244245 configuration . AssemblyVersioningScheme . ShouldBe ( AssemblyVersioningScheme . MajorMinorPatch ) ;
245246 configuration . AssemblyFileVersioningScheme . ShouldBe ( AssemblyFileVersioningScheme . MajorMinorPatch ) ;
@@ -266,7 +267,8 @@ public void VerifyAliases()
266267 [ Test ]
267268 public void NoWarnOnGitVersionYmlFile ( )
268269 {
269- fileSystem . SetupConfigFile ( string . Empty , this . repoPath ) ;
270+ const string text = "" ;
271+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
270272
271273 var stringLogger = string . Empty ;
272274 void Action ( string info ) => stringLogger = info ;
@@ -297,7 +299,7 @@ public void ShouldUseSpecifiedSourceBranchesForDevelop()
297299 mode: ContinuousDeployment
298300 source-branches: ['develop']
299301 label: dev" ;
300- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
302+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
301303 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
302304
303305 configuration . Branches [ "develop" ] . SourceBranches . ShouldBe ( new List < string > { "develop" } ) ;
@@ -312,7 +314,7 @@ public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForDevelop()
312314 develop:
313315 mode: ContinuousDeployment
314316 label: dev" ;
315- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
317+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
316318 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
317319
318320 configuration . Branches [ "develop" ] . SourceBranches . ShouldBe ( new List < string > ( ) ) ;
@@ -328,7 +330,7 @@ public void ShouldUseSpecifiedSourceBranchesForFeature()
328330 mode: ContinuousDeployment
329331 source-branches: ['develop', 'release']
330332 label: dev" ;
331- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
333+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
332334 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
333335
334336 configuration . Branches [ "feature" ] . SourceBranches . ShouldBe ( new List < string > { "develop" , "release" } ) ;
@@ -343,7 +345,7 @@ public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForFeature()
343345 feature:
344346 mode: ContinuousDeployment
345347 label: dev" ;
346- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
348+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
347349 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
348350
349351 configuration . Branches [ "feature" ] . SourceBranches . ShouldBe (
@@ -356,7 +358,7 @@ public void ShouldNotOverrideAnythingWhenOverrideConfigIsEmpty()
356358 const string text = @"
357359next-version: 1.2.3
358360tag-prefix: custom-tag-prefix-from-yml" ;
359- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
361+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
360362
361363 var expectedConfig = GitFlowConfigurationBuilder . New
362364 . WithNextVersion ( "1.2.3" )
@@ -394,7 +396,7 @@ public void ShouldNotOverrideAnythingWhenOverrideConfigIsEmpty()
394396 public void ShouldUseDefaultTagPrefixWhenNotSetInConfigFile ( )
395397 {
396398 const string text = "" ;
397- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
399+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
398400 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
399401
400402 configuration . TagPrefix . ShouldBe ( ConfigurationConstants . DefaultTagPrefix ) ;
@@ -404,7 +406,7 @@ public void ShouldUseDefaultTagPrefixWhenNotSetInConfigFile()
404406 public void ShouldUseTagPrefixFromConfigFileWhenProvided ( )
405407 {
406408 const string text = "tag-prefix: custom-tag-prefix-from-yml" ;
407- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
409+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
408410 var configuration = this . configurationProvider . ProvideForDirectory ( this . repoPath ) ;
409411
410412 configuration . TagPrefix . ShouldBe ( "custom-tag-prefix-from-yml" ) ;
@@ -414,7 +416,7 @@ public void ShouldUseTagPrefixFromConfigFileWhenProvided()
414416 public void ShouldOverrideTagPrefixWithOverrideConfigValue ( [ Values ] bool tagPrefixSetAtYmlFile )
415417 {
416418 var text = tagPrefixSetAtYmlFile ? "tag-prefix: custom-tag-prefix-from-yml" : "" ;
417- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
419+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
418420 var overrideConfiguration = new Dictionary < object , object ? >
419421 {
420422 { "tag-prefix" , "tag-prefix-from-override-configuration" }
@@ -428,7 +430,7 @@ public void ShouldOverrideTagPrefixWithOverrideConfigValue([Values] bool tagPref
428430 public void ShouldNotOverrideDefaultTagPrefixWhenNotSetInOverrideConfig ( )
429431 {
430432 const string text = "" ;
431- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
433+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
432434 var overrideConfiguration = new Dictionary < object , object ? >
433435 {
434436 { "next-version" , "1.0.0" }
@@ -443,7 +445,7 @@ public void ShouldNotOverrideDefaultTagPrefixWhenNotSetInOverrideConfig()
443445 public void ShouldNotOverrideTagPrefixFromConfigFileWhenNotSetInOverrideConfig ( )
444446 {
445447 const string text = "tag-prefix: custom-tag-prefix-from-yml" ;
446- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
448+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
447449 var overrideConfiguration = new Dictionary < object , object ? >
448450 {
449451 { "next-version" , "1.0.0" }
@@ -457,7 +459,7 @@ public void ShouldNotOverrideTagPrefixFromConfigFileWhenNotSetInOverrideConfig()
457459 public void ShouldOverrideTagPrefixFromConfigFileWhenSetInOverrideConfig ( )
458460 {
459461 const string text = "tag-prefix: custom-tag-prefix-from-yml" ;
460- fileSystem . SetupConfigFile ( text , this . repoPath ) ;
462+ using var _ = this . fileSystem . SetupConfigFile ( path : this . repoPath , text : text ) ;
461463 var overrideConfiguration = new Dictionary < object , object ? >
462464 {
463465 { "tag-prefix" , "custom-tag-prefix-from-console" }
0 commit comments