@@ -21,12 +21,12 @@ public class NamedConfigFileLocatorTests : TestBase
21
21
private string workingPath ;
22
22
private IFileSystem fileSystem ;
23
23
private IConfigFileLocator configFileLocator ;
24
- private Arguments arguments ;
24
+ private GitVersionOptions gitVersionOptions ;
25
25
26
26
[ SetUp ]
27
27
public void Setup ( )
28
28
{
29
- arguments = new Arguments { ConfigFile = "my-config.yaml" } ;
29
+ gitVersionOptions = new GitVersionOptions { ConfigInfo = { ConfigFile = "my-config.yaml" } } ;
30
30
repoPath = DefaultRepoPath ;
31
31
workingPath = DefaultWorkingPath ;
32
32
@@ -36,7 +36,7 @@ public void Setup()
36
36
[ Test ]
37
37
public void ThrowsExceptionOnAmbiguousConfigFileLocation ( )
38
38
{
39
- var sp = GetServiceProvider ( arguments ) ;
39
+ var sp = GetServiceProvider ( gitVersionOptions ) ;
40
40
configFileLocator = sp . GetService < IConfigFileLocator > ( ) ;
41
41
fileSystem = sp . GetService < IFileSystem > ( ) ;
42
42
@@ -54,7 +54,7 @@ public void DoNotThrowWhenWorkingAndRepoPathsAreSame()
54
54
{
55
55
workingPath = DefaultRepoPath ;
56
56
57
- var sp = GetServiceProvider ( arguments ) ;
57
+ var sp = GetServiceProvider ( gitVersionOptions ) ;
58
58
configFileLocator = sp . GetService < IConfigFileLocator > ( ) ;
59
59
fileSystem = sp . GetService < IFileSystem > ( ) ;
60
60
@@ -68,7 +68,7 @@ public void DoNotThrowWhenWorkingAndRepoPathsAreSame_WithDifferentCasing()
68
68
{
69
69
workingPath = DefaultRepoPath . ToLower ( ) ;
70
70
71
- var sp = GetServiceProvider ( arguments ) ;
71
+ var sp = GetServiceProvider ( gitVersionOptions ) ;
72
72
configFileLocator = sp . GetService < IConfigFileLocator > ( ) ;
73
73
fileSystem = sp . GetService < IFileSystem > ( ) ;
74
74
@@ -82,8 +82,8 @@ public void DoNotThrowWhenConfigFileIsInSubDirectoryOfRepoPath()
82
82
{
83
83
workingPath = DefaultRepoPath ;
84
84
85
- arguments = new Arguments { ConfigFile = "./src/my-config.yaml" } ;
86
- var sp = GetServiceProvider ( arguments ) ;
85
+ gitVersionOptions = new GitVersionOptions { ConfigInfo = { ConfigFile = "./src/my-config.yaml" } } ;
86
+ var sp = GetServiceProvider ( gitVersionOptions ) ;
87
87
configFileLocator = sp . GetService < IConfigFileLocator > ( ) ;
88
88
fileSystem = sp . GetService < IFileSystem > ( ) ;
89
89
@@ -101,7 +101,7 @@ public void NoWarnOnCustomYmlFile()
101
101
var logAppender = new TestLogAppender ( Action ) ;
102
102
var log = new Log ( logAppender ) ;
103
103
104
- var sp = GetServiceProvider ( arguments , log ) ;
104
+ var sp = GetServiceProvider ( gitVersionOptions , log ) ;
105
105
configFileLocator = sp . GetService < IConfigFileLocator > ( ) ;
106
106
fileSystem = sp . GetService < IFileSystem > ( ) ;
107
107
@@ -122,7 +122,7 @@ public void NoWarnOnCustomYmlFileOutsideRepoPath()
122
122
var logAppender = new TestLogAppender ( Action ) ;
123
123
var log = new Log ( logAppender ) ;
124
124
125
- var sp = GetServiceProvider ( arguments , log ) ;
125
+ var sp = GetServiceProvider ( gitVersionOptions , log ) ;
126
126
configFileLocator = sp . GetService < IConfigFileLocator > ( ) ;
127
127
fileSystem = sp . GetService < IFileSystem > ( ) ;
128
128
@@ -137,13 +137,13 @@ public void NoWarnOnCustomYmlFileOutsideRepoPath()
137
137
[ Test ]
138
138
public void ThrowsExceptionOnCustomYmlFileDoesNotExist ( )
139
139
{
140
- var sp = GetServiceProvider ( arguments ) ;
140
+ var sp = GetServiceProvider ( gitVersionOptions ) ;
141
141
configFileLocator = sp . GetService < IConfigFileLocator > ( ) ;
142
142
143
143
var exception = Should . Throw < WarningException > ( ( ) => { configFileLocator . Verify ( workingPath , repoPath ) ; } ) ;
144
144
145
- var workingPathFileConfig = Path . Combine ( workingPath , arguments . ConfigFile ) ;
146
- var repoPathFileConfig = Path . Combine ( repoPath , arguments . ConfigFile ) ;
145
+ var workingPathFileConfig = Path . Combine ( workingPath , gitVersionOptions . ConfigInfo . ConfigFile ) ;
146
+ var repoPathFileConfig = Path . Combine ( repoPath , gitVersionOptions . ConfigInfo . ConfigFile ) ;
147
147
var expectedMessage = $ "The configuration file was not found at '{ workingPathFileConfig } ' or '{ repoPathFileConfig } '";
148
148
exception . Message . ShouldBe ( expectedMessage ) ;
149
149
}
@@ -158,12 +158,12 @@ private string SetupConfigFileContent(string text, string fileName = null, strin
158
158
return filePath ;
159
159
}
160
160
161
- private static IServiceProvider GetServiceProvider ( Arguments arguments , ILog log = null )
161
+ private static IServiceProvider GetServiceProvider ( GitVersionOptions gitVersionOptions , ILog log = null )
162
162
{
163
163
return ConfigureServices ( services =>
164
164
{
165
165
if ( log != null ) services . AddSingleton ( log ) ;
166
- services . AddSingleton ( Options . Create ( arguments ) ) ;
166
+ services . AddSingleton ( Options . Create ( gitVersionOptions ) ) ;
167
167
} ) ;
168
168
}
169
169
}
0 commit comments