@@ -39,6 +39,9 @@ public void Setup()
3939 }
4040
4141 [ TestCase ( ConfigurationFileLocator . DefaultFileName , ConfigurationFileLocator . DefaultFileName ) ]
42+ [ TestCase ( ConfigurationFileLocator . DefaultFileName , ConfigurationFileLocator . DefaultAlternativeFileName ) ]
43+ [ TestCase ( ConfigurationFileLocator . DefaultAlternativeFileName , ConfigurationFileLocator . DefaultFileName ) ]
44+ [ TestCase ( ConfigurationFileLocator . DefaultAlternativeFileName , ConfigurationFileLocator . DefaultAlternativeFileName ) ]
4245 public void ThrowsExceptionOnAmbiguousConfigFileLocation ( string repoConfigFile , string workingConfigFile )
4346 {
4447 var repositoryConfigFilePath = SetupConfigFileContent ( string . Empty , repoConfigFile , this . repoPath ) ;
@@ -50,16 +53,17 @@ public void ThrowsExceptionOnAmbiguousConfigFileLocation(string repoConfigFile,
5053 exception . Message . ShouldBe ( expectedMessage ) ;
5154 }
5255
53- [ Test ]
54- public void NoWarnOnGitVersionYmlFile ( )
56+ [ TestCase ( ConfigurationFileLocator . DefaultFileName ) ]
57+ [ TestCase ( ConfigurationFileLocator . DefaultAlternativeFileName ) ]
58+ public void NoWarnOnGitVersionYmlFile ( string configurationFile )
5559 {
56- SetupConfigFileContent ( string . Empty , ConfigurationFileLocator . DefaultFileName , this . repoPath ) ;
60+ SetupConfigFileContent ( string . Empty , configurationFile , this . repoPath ) ;
5761
58- Should . NotThrow ( ( ) => this . configurationProvider . ProvideInternal ( this . repoPath ) ) ;
62+ Should . NotThrow ( ( ) => this . configurationProvider . ProvideForDirectory ( this . repoPath ) ) ;
5963 }
6064
6165 [ Test ]
62- public void NoWarnOnNoGitVersionYmlFile ( ) => Should . NotThrow ( ( ) => this . configurationProvider . ProvideInternal ( this . repoPath ) ) ;
66+ public void NoWarnOnNoGitVersionYmlFile ( ) => Should . NotThrow ( ( ) => this . configurationProvider . ProvideForDirectory ( this . repoPath ) ) ;
6367
6468 private string SetupConfigFileContent ( string text , string fileName , string path )
6569 {
@@ -74,6 +78,7 @@ public class NamedConfigurationFileLocatorTests : TestBase
7478 {
7579 private const string DefaultRepoPath = @"c:\MyGitRepo" ;
7680 private const string DefaultWorkingPath = @"c:\MyGitRepo\Working" ;
81+ private const string myConfigYaml = "my-config.yaml" ;
7782
7883 private string repoPath ;
7984 private string workingPath ;
@@ -84,7 +89,7 @@ public class NamedConfigurationFileLocatorTests : TestBase
8489 [ SetUp ]
8590 public void Setup ( )
8691 {
87- this . gitVersionOptions = new GitVersionOptions { ConfigurationInfo = { ConfigurationFile = "my-config.yaml" } } ;
92+ this . gitVersionOptions = new GitVersionOptions { ConfigurationInfo = { ConfigurationFile = myConfigYaml } } ;
8893 this . repoPath = DefaultRepoPath ;
8994 this . workingPath = DefaultWorkingPath ;
9095
@@ -167,7 +172,7 @@ public void NoWarnOnCustomYmlFile()
167172
168173 var configurationProvider = ( ConfigurationProvider ) sp . GetRequiredService < IConfigurationProvider > ( ) ;
169174
170- configurationProvider . ProvideInternal ( this . repoPath ) ;
175+ configurationProvider . ProvideForDirectory ( this . repoPath ) ;
171176 stringLogger . Length . ShouldBe ( 0 ) ;
172177 }
173178
@@ -188,7 +193,7 @@ public void NoWarnOnCustomYmlFileOutsideRepoPath()
188193
189194 var configurationProvider = ( ConfigurationProvider ) sp . GetRequiredService < IConfigurationProvider > ( ) ;
190195
191- configurationProvider . ProvideInternal ( this . repoPath ) ;
196+ configurationProvider . ProvideForDirectory ( this . repoPath ) ;
192197 stringLogger . Length . ShouldBe ( 0 ) ;
193198 }
194199
@@ -200,20 +205,24 @@ public void ThrowsExceptionOnCustomYmlFileDoesNotExist()
200205
201206 var exception = Should . Throw < WarningException > ( ( ) => this . configFileLocator . Verify ( this . workingPath , this . repoPath ) ) ;
202207
203- var workingPathFileConfig = PathHelper . Combine ( this . workingPath , this . gitVersionOptions . ConfigurationInfo . ConfigurationFile ) ;
204- var repoPathFileConfig = PathHelper . Combine ( this . repoPath , this . gitVersionOptions . ConfigurationInfo . ConfigurationFile ) ;
208+ var configurationFile = this . gitVersionOptions . ConfigurationInfo . ConfigurationFile ;
209+ var workingPathFileConfig = PathHelper . Combine ( this . workingPath , configurationFile ) ;
210+ var repoPathFileConfig = PathHelper . Combine ( this . repoPath , configurationFile ) ;
205211 var expectedMessage = $ "The configuration file was not found at '{ workingPathFileConfig } ' or '{ repoPathFileConfig } '";
206212 exception . Message . ShouldBe ( expectedMessage ) ;
207213 }
208214
209215 private string SetupConfigFileContent ( string text , string ? fileName = null , string ? path = null )
210216 {
211- if ( fileName . IsNullOrEmpty ( ) ) fileName = this . configFileLocator . FilePath ;
217+ if ( fileName . IsNullOrEmpty ( ) )
218+ {
219+ fileName = gitVersionOptions . ConfigurationInfo . ConfigurationFile ;
220+ }
212221 var filePath = fileName ;
213222 if ( ! path . IsNullOrEmpty ( ) )
214223 filePath = PathHelper . Combine ( path , filePath ) ;
215224 this . fileSystem . WriteAllText ( filePath , text ) ;
216- return filePath ;
225+ return filePath ! ;
217226 }
218227
219228 private static IServiceProvider GetServiceProvider ( GitVersionOptions gitVersionOptions , ILog ? log = null ) =>
0 commit comments