@@ -25,7 +25,7 @@ public class ConfigProviderTests : TestBase
25
25
private string repoPath ;
26
26
private IFileSystem fileSystem ;
27
27
private IConfigFileLocator configFileLocator ;
28
- private IConfigurationProvider configurationProvider ;
28
+ private IConfigProvider configProvider ;
29
29
private IConfigInitWizard configInitWizard ;
30
30
31
31
[ SetUp ]
@@ -39,7 +39,7 @@ public void Setup()
39
39
repoPath = DefaultRepoPath ;
40
40
41
41
var gitPreparer = new GitPreparer ( log , Options . Create ( new Arguments { TargetPath = repoPath } ) ) ;
42
- configurationProvider = new ConfigurationProvider ( fileSystem , log , configFileLocator , gitPreparer , configInitWizard ) ;
42
+ configProvider = new ConfigProvider ( fileSystem , log , configFileLocator , gitPreparer , configInitWizard ) ;
43
43
44
44
ShouldlyConfiguration . ShouldMatchApprovedDefaults . LocateTestMethodUsingAttribute < TestAttribute > ( ) ;
45
45
}
@@ -62,7 +62,7 @@ public void CanReadOldDocument()
62
62
tag: rc
63
63
" ;
64
64
SetupConfigFileContent ( text ) ;
65
- var error = Should . Throw < OldConfigurationException > ( ( ) => configurationProvider . Provide ( repoPath ) ) ;
65
+ var error = Should . Throw < OldConfigurationException > ( ( ) => configProvider . Provide ( repoPath ) ) ;
66
66
error . Message . ShouldContainWithoutWhitespace ( @"GitVersion configuration file contains old configuration, please fix the following errors:
67
67
GitVersion branch configs no longer are keyed by regexes, update:
68
68
dev(elop)?(ment)?$ -> develop
@@ -75,15 +75,15 @@ assemblyVersioningScheme has been replaced by assembly-versioning-scheme
75
75
[ Test ]
76
76
public void OverwritesDefaultsWithProvidedConfig ( )
77
77
{
78
- var defaultConfig = configurationProvider . Provide ( repoPath ) ;
78
+ var defaultConfig = configProvider . Provide ( repoPath ) ;
79
79
const string text = @"
80
80
next-version: 2.0.0
81
81
branches:
82
82
develop:
83
83
mode: ContinuousDeployment
84
84
tag: dev" ;
85
85
SetupConfigFileContent ( text ) ;
86
- var config = configurationProvider . Provide ( repoPath ) ;
86
+ var config = configProvider . Provide ( repoPath ) ;
87
87
88
88
config . NextVersion . ShouldBe ( "2.0.0" ) ;
89
89
config . Branches [ "develop" ] . Increment . ShouldBe ( defaultConfig . Branches [ "develop" ] . Increment ) ;
@@ -96,7 +96,7 @@ public void AllBranchesModeWhenUsingMainline()
96
96
{
97
97
const string text = @"mode: Mainline" ;
98
98
SetupConfigFileContent ( text ) ;
99
- var config = configurationProvider . Provide ( repoPath ) ;
99
+ var config = configProvider . Provide ( repoPath ) ;
100
100
var branches = config . Branches . Select ( x => x . Value ) ;
101
101
branches . All ( branch => branch . VersioningMode == VersioningMode . Mainline ) . ShouldBe ( true ) ;
102
102
}
@@ -110,7 +110,7 @@ public void CanRemoveTag()
110
110
release:
111
111
tag: """"" ;
112
112
SetupConfigFileContent ( text ) ;
113
- var config = configurationProvider . Provide ( repoPath ) ;
113
+ var config = configProvider . Provide ( repoPath ) ;
114
114
115
115
config . NextVersion . ShouldBe ( "2.0.0" ) ;
116
116
config . Branches [ "release" ] . Tag . ShouldBe ( string . Empty ) ;
@@ -125,7 +125,7 @@ public void RegexIsRequired()
125
125
bug:
126
126
tag: bugfix" ;
127
127
SetupConfigFileContent ( text ) ;
128
- var ex = Should . Throw < GitVersionConfigurationException > ( ( ) => configurationProvider . Provide ( repoPath ) ) ;
128
+ var ex = Should . Throw < GitVersionConfigurationException > ( ( ) => configProvider . Provide ( repoPath ) ) ;
129
129
ex . Message . ShouldBe ( "Branch configuration 'bug' is missing required configuration 'regex'\n \n " +
130
130
"See http://gitversion.readthedocs.io/en/latest/configuration/ for more info" ) ;
131
131
}
@@ -140,7 +140,7 @@ public void SourceBranchIsRequired()
140
140
regex: 'bug[/-]'
141
141
tag: bugfix" ;
142
142
SetupConfigFileContent ( text ) ;
143
- var ex = Should . Throw < GitVersionConfigurationException > ( ( ) => configurationProvider . Provide ( repoPath ) ) ;
143
+ var ex = Should . Throw < GitVersionConfigurationException > ( ( ) => configProvider . Provide ( repoPath ) ) ;
144
144
ex . Message . ShouldBe ( "Branch configuration 'bug' is missing required configuration 'source-branches'\n \n " +
145
145
"See http://gitversion.readthedocs.io/en/latest/configuration/ for more info" ) ;
146
146
}
@@ -156,7 +156,7 @@ public void CanProvideConfigForNewBranch()
156
156
tag: bugfix
157
157
source-branches: []" ;
158
158
SetupConfigFileContent ( text ) ;
159
- var config = configurationProvider . Provide ( repoPath ) ;
159
+ var config = configProvider . Provide ( repoPath ) ;
160
160
161
161
config . Branches [ "bug" ] . Regex . ShouldBe ( "bug[/-]" ) ;
162
162
config . Branches [ "bug" ] . Tag . ShouldBe ( "bugfix" ) ;
@@ -167,7 +167,7 @@ public void NextVersionCanBeInteger()
167
167
{
168
168
const string text = "next-version: 2" ;
169
169
SetupConfigFileContent ( text ) ;
170
- var config = configurationProvider . Provide ( repoPath ) ;
170
+ var config = configProvider . Provide ( repoPath ) ;
171
171
172
172
config . NextVersion . ShouldBe ( "2.0" ) ;
173
173
}
@@ -177,7 +177,7 @@ public void NextVersionCanHaveEnormousMinorVersion()
177
177
{
178
178
const string text = "next-version: 2.118998723" ;
179
179
SetupConfigFileContent ( text ) ;
180
- var config = configurationProvider . Provide ( repoPath ) ;
180
+ var config = configProvider . Provide ( repoPath ) ;
181
181
182
182
config . NextVersion . ShouldBe ( "2.118998723" ) ;
183
183
}
@@ -187,7 +187,7 @@ public void NextVersionCanHavePatch()
187
187
{
188
188
const string text = "next-version: 2.12.654651698" ;
189
189
SetupConfigFileContent ( text ) ;
190
- var config = configurationProvider . Provide ( repoPath ) ;
190
+ var config = configProvider . Provide ( repoPath ) ;
191
191
192
192
config . NextVersion . ShouldBe ( "2.12.654651698" ) ;
193
193
}
@@ -198,9 +198,9 @@ public void NextVersionCanHavePatch()
198
198
[ Description ( "Won't run on Mono due to source information not being available for ShouldMatchApproved." ) ]
199
199
public void CanWriteOutEffectiveConfiguration ( )
200
200
{
201
- var config = configurationProvider . GetEffectiveConfigAsString ( repoPath ) ;
201
+ var config = configProvider . Provide ( repoPath ) ;
202
202
203
- config . ShouldMatchApproved ( ) ;
203
+ config . ToString ( ) . ShouldMatchApproved ( ) ;
204
204
}
205
205
206
206
[ Test ]
@@ -213,7 +213,7 @@ public void CanUpdateAssemblyInformationalVersioningScheme()
213
213
214
214
SetupConfigFileContent ( text ) ;
215
215
216
- var config = configurationProvider . Provide ( repoPath ) ;
216
+ var config = configProvider . Provide ( repoPath ) ;
217
217
config . AssemblyVersioningScheme . ShouldBe ( AssemblyVersioningScheme . MajorMinor ) ;
218
218
config . AssemblyFileVersioningScheme . ShouldBe ( AssemblyFileVersioningScheme . MajorMinorPatch ) ;
219
219
config . AssemblyInformationalFormat . ShouldBe ( "{NugetVersion}" ) ;
@@ -229,7 +229,7 @@ public void CanUpdateAssemblyInformationalVersioningSchemeWithMultipleVariables(
229
229
230
230
SetupConfigFileContent ( text ) ;
231
231
232
- var config = configurationProvider . Provide ( repoPath ) ;
232
+ var config = configProvider . Provide ( repoPath ) ;
233
233
config . AssemblyVersioningScheme . ShouldBe ( AssemblyVersioningScheme . MajorMinor ) ;
234
234
config . AssemblyFileVersioningScheme . ShouldBe ( AssemblyFileVersioningScheme . MajorMinorPatch ) ;
235
235
config . AssemblyInformationalFormat . ShouldBe ( "{Major}.{Minor}.{Patch}" ) ;
@@ -248,7 +248,7 @@ public void CanUpdateAssemblyInformationalVersioningSchemeWithFullSemVer()
248
248
249
249
SetupConfigFileContent ( text ) ;
250
250
251
- var config = configurationProvider . Provide ( repoPath ) ;
251
+ var config = configProvider . Provide ( repoPath ) ;
252
252
config . AssemblyVersioningScheme . ShouldBe ( AssemblyVersioningScheme . MajorMinorPatch ) ;
253
253
config . AssemblyFileVersioningScheme . ShouldBe ( AssemblyFileVersioningScheme . MajorMinorPatch ) ;
254
254
config . AssemblyInformationalFormat . ShouldBe ( "{FullSemVer}" ) ;
@@ -259,13 +259,13 @@ public void CanReadDefaultDocument()
259
259
{
260
260
const string text = "" ;
261
261
SetupConfigFileContent ( text ) ;
262
- var config = configurationProvider . Provide ( repoPath ) ;
262
+ var config = configProvider . Provide ( repoPath ) ;
263
263
config . AssemblyVersioningScheme . ShouldBe ( AssemblyVersioningScheme . MajorMinorPatch ) ;
264
264
config . AssemblyFileVersioningScheme . ShouldBe ( AssemblyFileVersioningScheme . MajorMinorPatch ) ;
265
265
config . AssemblyInformationalFormat . ShouldBe ( null ) ;
266
266
config . Branches [ "develop" ] . Tag . ShouldBe ( "alpha" ) ;
267
267
config . Branches [ "release" ] . Tag . ShouldBe ( "beta" ) ;
268
- config . TagPrefix . ShouldBe ( ConfigurationConstants . DefaultTagPrefix ) ;
268
+ config . TagPrefix . ShouldBe ( Config . DefaultTagPrefix ) ;
269
269
config . NextVersion . ShouldBe ( null ) ;
270
270
}
271
271
@@ -295,9 +295,9 @@ public void NoWarnOnGitVersionYmlFile()
295
295
var defaultConfigFileLocator = new DefaultConfigFileLocator ( fileSystem , log ) ;
296
296
var gitPreparer = new GitPreparer ( log , Options . Create ( new Arguments { TargetPath = repoPath } ) ) ;
297
297
298
- configurationProvider = new ConfigurationProvider ( fileSystem , log , defaultConfigFileLocator , gitPreparer , configInitWizard ) ;
298
+ configProvider = new ConfigProvider ( fileSystem , log , defaultConfigFileLocator , gitPreparer , configInitWizard ) ;
299
299
300
- configurationProvider . Provide ( repoPath ) ;
300
+ configProvider . Provide ( repoPath ) ;
301
301
302
302
stringLogger . Length . ShouldBe ( 0 ) ;
303
303
}
@@ -326,7 +326,7 @@ public void ShouldUseSpecifiedSourceBranchesForDevelop()
326
326
source-branches: ['develop']
327
327
tag: dev" ;
328
328
SetupConfigFileContent ( text ) ;
329
- var config = configurationProvider . Provide ( repoPath ) ;
329
+ var config = configProvider . Provide ( repoPath ) ;
330
330
331
331
config . Branches [ "develop" ] . SourceBranches . ShouldBe ( new List < string > { "develop" } ) ;
332
332
}
@@ -341,7 +341,7 @@ public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForDevelop()
341
341
mode: ContinuousDeployment
342
342
tag: dev" ;
343
343
SetupConfigFileContent ( text ) ;
344
- var config = configurationProvider . Provide ( repoPath ) ;
344
+ var config = configProvider . Provide ( repoPath ) ;
345
345
346
346
config . Branches [ "develop" ] . SourceBranches . ShouldBe ( new List < string > ( ) ) ;
347
347
}
@@ -357,7 +357,7 @@ public void ShouldUseSpecifiedSourceBranchesForFeature()
357
357
source-branches: ['develop', 'release']
358
358
tag: dev" ;
359
359
SetupConfigFileContent ( text ) ;
360
- var config = configurationProvider . Provide ( repoPath ) ;
360
+ var config = configProvider . Provide ( repoPath ) ;
361
361
362
362
config . Branches [ "feature" ] . SourceBranches . ShouldBe ( new List < string > { "develop" , "release" } ) ;
363
363
}
@@ -372,7 +372,7 @@ public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForFeature()
372
372
mode: ContinuousDeployment
373
373
tag: dev" ;
374
374
SetupConfigFileContent ( text ) ;
375
- var config = configurationProvider . Provide ( repoPath ) ;
375
+ var config = configProvider . Provide ( repoPath ) ;
376
376
377
377
config . Branches [ "feature" ] . SourceBranches . ShouldBe (
378
378
new List < string > { "develop" , "master" , "release" , "feature" , "support" , "hotfix" } ) ;
0 commit comments