Skip to content

Commit b97cd41

Browse files
committed
code review adjustments
1 parent 7b173a0 commit b97cd41

File tree

75 files changed

+209
-245
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+209
-245
lines changed

src/GitVersionCore.Tests/AssemblyFileVersionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using NUnit.Framework;
22
using Shouldly;
33
using GitVersion.Extensions;
4-
using GitVersion.SemanticVersioning;
4+
using GitVersion;
55

66
namespace GitVersionCore.Tests
77
{

src/GitVersionCore.Tests/AssemblyInfoFileUpdaterTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using GitVersion.Extensions.VersionAssemblyInfoResources;
1010
using GitVersion;
1111
using GitVersion.Logging;
12-
using GitVersion.SemanticVersioning;
1312
using GitVersion.VersionCalculation;
1413

1514
namespace GitVersionCore.Tests

src/GitVersionCore.Tests/BuildServers/BuildServerBaseTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using GitVersion.OutputVariables;
66
using GitVersion;
77
using GitVersion.Logging;
8-
using GitVersion.SemanticVersioning;
98
using GitVersion.VersionCalculation;
109

1110
namespace GitVersionCore.Tests.BuildServers

src/GitVersionCore.Tests/BuildServers/CodeBuildTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using GitVersion;
99
using GitVersion.OutputVariables;
1010
using GitVersion.Logging;
11-
using GitVersion.SemanticVersioning;
1211
using GitVersion.VersionCalculation;
1312

1413
namespace GitVersionCore.Tests.BuildServers

src/GitVersionCore.Tests/BuildServers/GitLabCiMessageGenerationTest.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using GitVersion;
99
using GitVersion.Logging;
1010
using GitVersion.OutputVariables;
11-
using GitVersion.SemanticVersioning;
1211
using GitVersion.VersionCalculation;
1312

1413
namespace GitVersionCore.Tests.BuildServers

src/GitVersionCore.Tests/BuildServers/JenkinsMessageGenerationTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using GitVersion;
99
using GitVersion.Logging;
1010
using GitVersion.OutputVariables;
11-
using GitVersion.SemanticVersioning;
1211
using GitVersion.VersionCalculation;
1312

1413
namespace GitVersionCore.Tests.BuildServers

src/GitVersionCore.Tests/CommitDateTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using GitVersion.Configuration;
77
using GitVersion.VersioningModes;
88
using GitVersion.Extensions;
9-
using GitVersion.SemanticVersioning;
109

1110
namespace GitVersionCore.Tests
1211
{

src/GitVersionCore.Tests/ConfigProviderTests.cs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class ConfigProviderTests : TestBase
2525
private string repoPath;
2626
private IFileSystem fileSystem;
2727
private IConfigFileLocator configFileLocator;
28-
private IConfigurationProvider configurationProvider;
28+
private IConfigProvider configProvider;
2929
private IConfigInitWizard configInitWizard;
3030

3131
[SetUp]
@@ -39,7 +39,7 @@ public void Setup()
3939
repoPath = DefaultRepoPath;
4040

4141
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);
4343

4444
ShouldlyConfiguration.ShouldMatchApprovedDefaults.LocateTestMethodUsingAttribute<TestAttribute>();
4545
}
@@ -62,7 +62,7 @@ public void CanReadOldDocument()
6262
tag: rc
6363
";
6464
SetupConfigFileContent(text);
65-
var error = Should.Throw<OldConfigurationException>(() => configurationProvider.Provide(repoPath));
65+
var error = Should.Throw<OldConfigurationException>(() => configProvider.Provide(repoPath));
6666
error.Message.ShouldContainWithoutWhitespace(@"GitVersion configuration file contains old configuration, please fix the following errors:
6767
GitVersion branch configs no longer are keyed by regexes, update:
6868
dev(elop)?(ment)?$ -> develop
@@ -75,15 +75,15 @@ assemblyVersioningScheme has been replaced by assembly-versioning-scheme
7575
[Test]
7676
public void OverwritesDefaultsWithProvidedConfig()
7777
{
78-
var defaultConfig = configurationProvider.Provide(repoPath);
78+
var defaultConfig = configProvider.Provide(repoPath);
7979
const string text = @"
8080
next-version: 2.0.0
8181
branches:
8282
develop:
8383
mode: ContinuousDeployment
8484
tag: dev";
8585
SetupConfigFileContent(text);
86-
var config = configurationProvider.Provide(repoPath);
86+
var config = configProvider.Provide(repoPath);
8787

8888
config.NextVersion.ShouldBe("2.0.0");
8989
config.Branches["develop"].Increment.ShouldBe(defaultConfig.Branches["develop"].Increment);
@@ -96,7 +96,7 @@ public void AllBranchesModeWhenUsingMainline()
9696
{
9797
const string text = @"mode: Mainline";
9898
SetupConfigFileContent(text);
99-
var config = configurationProvider.Provide(repoPath);
99+
var config = configProvider.Provide(repoPath);
100100
var branches = config.Branches.Select(x => x.Value);
101101
branches.All(branch => branch.VersioningMode == VersioningMode.Mainline).ShouldBe(true);
102102
}
@@ -110,7 +110,7 @@ public void CanRemoveTag()
110110
release:
111111
tag: """"";
112112
SetupConfigFileContent(text);
113-
var config = configurationProvider.Provide(repoPath);
113+
var config = configProvider.Provide(repoPath);
114114

115115
config.NextVersion.ShouldBe("2.0.0");
116116
config.Branches["release"].Tag.ShouldBe(string.Empty);
@@ -125,7 +125,7 @@ public void RegexIsRequired()
125125
bug:
126126
tag: bugfix";
127127
SetupConfigFileContent(text);
128-
var ex = Should.Throw<GitVersionConfigurationException>(() => configurationProvider.Provide(repoPath));
128+
var ex = Should.Throw<GitVersionConfigurationException>(() => configProvider.Provide(repoPath));
129129
ex.Message.ShouldBe("Branch configuration 'bug' is missing required configuration 'regex'\n\n" +
130130
"See http://gitversion.readthedocs.io/en/latest/configuration/ for more info");
131131
}
@@ -140,7 +140,7 @@ public void SourceBranchIsRequired()
140140
regex: 'bug[/-]'
141141
tag: bugfix";
142142
SetupConfigFileContent(text);
143-
var ex = Should.Throw<GitVersionConfigurationException>(() => configurationProvider.Provide(repoPath));
143+
var ex = Should.Throw<GitVersionConfigurationException>(() => configProvider.Provide(repoPath));
144144
ex.Message.ShouldBe("Branch configuration 'bug' is missing required configuration 'source-branches'\n\n" +
145145
"See http://gitversion.readthedocs.io/en/latest/configuration/ for more info");
146146
}
@@ -156,7 +156,7 @@ public void CanProvideConfigForNewBranch()
156156
tag: bugfix
157157
source-branches: []";
158158
SetupConfigFileContent(text);
159-
var config = configurationProvider.Provide(repoPath);
159+
var config = configProvider.Provide(repoPath);
160160

161161
config.Branches["bug"].Regex.ShouldBe("bug[/-]");
162162
config.Branches["bug"].Tag.ShouldBe("bugfix");
@@ -167,7 +167,7 @@ public void NextVersionCanBeInteger()
167167
{
168168
const string text = "next-version: 2";
169169
SetupConfigFileContent(text);
170-
var config = configurationProvider.Provide(repoPath);
170+
var config = configProvider.Provide(repoPath);
171171

172172
config.NextVersion.ShouldBe("2.0");
173173
}
@@ -177,7 +177,7 @@ public void NextVersionCanHaveEnormousMinorVersion()
177177
{
178178
const string text = "next-version: 2.118998723";
179179
SetupConfigFileContent(text);
180-
var config = configurationProvider.Provide(repoPath);
180+
var config = configProvider.Provide(repoPath);
181181

182182
config.NextVersion.ShouldBe("2.118998723");
183183
}
@@ -187,7 +187,7 @@ public void NextVersionCanHavePatch()
187187
{
188188
const string text = "next-version: 2.12.654651698";
189189
SetupConfigFileContent(text);
190-
var config = configurationProvider.Provide(repoPath);
190+
var config = configProvider.Provide(repoPath);
191191

192192
config.NextVersion.ShouldBe("2.12.654651698");
193193
}
@@ -198,9 +198,9 @@ public void NextVersionCanHavePatch()
198198
[Description("Won't run on Mono due to source information not being available for ShouldMatchApproved.")]
199199
public void CanWriteOutEffectiveConfiguration()
200200
{
201-
var config = configurationProvider.GetEffectiveConfigAsString(repoPath);
201+
var config = configProvider.Provide(repoPath);
202202

203-
config.ShouldMatchApproved();
203+
config.ToString().ShouldMatchApproved();
204204
}
205205

206206
[Test]
@@ -213,7 +213,7 @@ public void CanUpdateAssemblyInformationalVersioningScheme()
213213

214214
SetupConfigFileContent(text);
215215

216-
var config = configurationProvider.Provide(repoPath);
216+
var config = configProvider.Provide(repoPath);
217217
config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinor);
218218
config.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch);
219219
config.AssemblyInformationalFormat.ShouldBe("{NugetVersion}");
@@ -229,7 +229,7 @@ public void CanUpdateAssemblyInformationalVersioningSchemeWithMultipleVariables(
229229

230230
SetupConfigFileContent(text);
231231

232-
var config = configurationProvider.Provide(repoPath);
232+
var config = configProvider.Provide(repoPath);
233233
config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinor);
234234
config.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch);
235235
config.AssemblyInformationalFormat.ShouldBe("{Major}.{Minor}.{Patch}");
@@ -248,7 +248,7 @@ public void CanUpdateAssemblyInformationalVersioningSchemeWithFullSemVer()
248248

249249
SetupConfigFileContent(text);
250250

251-
var config = configurationProvider.Provide(repoPath);
251+
var config = configProvider.Provide(repoPath);
252252
config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinorPatch);
253253
config.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch);
254254
config.AssemblyInformationalFormat.ShouldBe("{FullSemVer}");
@@ -259,13 +259,13 @@ public void CanReadDefaultDocument()
259259
{
260260
const string text = "";
261261
SetupConfigFileContent(text);
262-
var config = configurationProvider.Provide(repoPath);
262+
var config = configProvider.Provide(repoPath);
263263
config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinorPatch);
264264
config.AssemblyFileVersioningScheme.ShouldBe(AssemblyFileVersioningScheme.MajorMinorPatch);
265265
config.AssemblyInformationalFormat.ShouldBe(null);
266266
config.Branches["develop"].Tag.ShouldBe("alpha");
267267
config.Branches["release"].Tag.ShouldBe("beta");
268-
config.TagPrefix.ShouldBe(ConfigurationConstants.DefaultTagPrefix);
268+
config.TagPrefix.ShouldBe(Config.DefaultTagPrefix);
269269
config.NextVersion.ShouldBe(null);
270270
}
271271

@@ -295,9 +295,9 @@ public void NoWarnOnGitVersionYmlFile()
295295
var defaultConfigFileLocator = new DefaultConfigFileLocator(fileSystem, log);
296296
var gitPreparer = new GitPreparer(log, Options.Create(new Arguments { TargetPath = repoPath }));
297297

298-
configurationProvider = new ConfigurationProvider(fileSystem, log, defaultConfigFileLocator, gitPreparer, configInitWizard);
298+
configProvider = new ConfigProvider(fileSystem, log, defaultConfigFileLocator, gitPreparer, configInitWizard);
299299

300-
configurationProvider.Provide(repoPath);
300+
configProvider.Provide(repoPath);
301301

302302
stringLogger.Length.ShouldBe(0);
303303
}
@@ -326,7 +326,7 @@ public void ShouldUseSpecifiedSourceBranchesForDevelop()
326326
source-branches: ['develop']
327327
tag: dev";
328328
SetupConfigFileContent(text);
329-
var config = configurationProvider.Provide(repoPath);
329+
var config = configProvider.Provide(repoPath);
330330

331331
config.Branches["develop"].SourceBranches.ShouldBe(new List<string> { "develop" });
332332
}
@@ -341,7 +341,7 @@ public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForDevelop()
341341
mode: ContinuousDeployment
342342
tag: dev";
343343
SetupConfigFileContent(text);
344-
var config = configurationProvider.Provide(repoPath);
344+
var config = configProvider.Provide(repoPath);
345345

346346
config.Branches["develop"].SourceBranches.ShouldBe(new List<string>());
347347
}
@@ -357,7 +357,7 @@ public void ShouldUseSpecifiedSourceBranchesForFeature()
357357
source-branches: ['develop', 'release']
358358
tag: dev";
359359
SetupConfigFileContent(text);
360-
var config = configurationProvider.Provide(repoPath);
360+
var config = configProvider.Provide(repoPath);
361361

362362
config.Branches["feature"].SourceBranches.ShouldBe(new List<string> { "develop", "release" });
363363
}
@@ -372,7 +372,7 @@ public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForFeature()
372372
mode: ContinuousDeployment
373373
tag: dev";
374374
SetupConfigFileContent(text);
375-
var config = configurationProvider.Provide(repoPath);
375+
var config = configProvider.Provide(repoPath);
376376

377377
config.Branches["feature"].SourceBranches.ShouldBe(
378378
new List<string> { "develop", "master", "release", "feature", "support", "hotfix" });

src/GitVersionCore.Tests/DefaultConfigFileLocatorTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void NoWarnOnGitVersionYmlFile()
9696
var stepFactory = new ConfigInitStepFactory();
9797
var configInitWizard = new ConfigInitWizard(new ConsoleAdapter(), stepFactory);
9898

99-
var configurationProvider = new ConfigurationProvider(fileSystem, log, defaultConfigFileLocator, gitPreparer, configInitWizard);
99+
var configurationProvider = new ConfigProvider(fileSystem, log, defaultConfigFileLocator, gitPreparer, configInitWizard);
100100

101101
configurationProvider.Provide(repoPath);
102102
});

src/GitVersionCore.Tests/DynamicRepositoryTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void FindsVersionInDynamicRepo(string name, string url, string targetBran
9898
var stepFactory = new ConfigInitStepFactory();
9999
var configInitWizard = new ConfigInitWizard(new ConsoleAdapter(), stepFactory);
100100

101-
var configurationProvider = new ConfigurationProvider(testFileSystem, log, configFileLocator, gitPreparer, configInitWizard);
101+
var configurationProvider = new ConfigProvider(testFileSystem, log, configFileLocator, gitPreparer, configInitWizard);
102102

103103
var variableProvider = new VariableProvider(nextVersionCalculator);
104104
var gitVersionCalculator = new GitVersionCalculator(testFileSystem, log, configFileLocator, configurationProvider, buildServerResolver, gitVersionCache, gitVersionFinder, gitPreparer, variableProvider, options);

0 commit comments

Comments
 (0)