Skip to content

Add various tests for inheriting version numbers in feature branches. #1009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
3 changes: 2 additions & 1 deletion src/GitVersionCore.Tests/GitToolsTestingExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace GitVersionCore.Tests
{
using System;
using System.Linq;
using GitTools;
using GitTools.Testing;
using GitVersion;
Expand All @@ -24,7 +25,7 @@ public static VersionVariables GetVersion(this RepositoryFixtureBase fixture, Co
}
var gitVersionContext = new GitVersionContext(repository ?? fixture.Repository, configuration, isForTrackedBranchOnly, commitId);
var executeGitVersion = ExecuteGitVersion(gitVersionContext);
var variables = VariableProvider.GetVariablesFor(executeGitVersion, gitVersionContext.Configuration, gitVersionContext.IsCurrentCommitTagged);
var variables = VariableProvider.GetVariablesFor(executeGitVersion, gitVersionContext.Configurations.First(), gitVersionContext.IsCurrentCommitTagged);
try
{
return variables;
Expand Down
7 changes: 4 additions & 3 deletions src/GitVersionCore.Tests/GitVersionContextTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace GitVersionCore.Tests
{
using System.Linq;
using GitTools.Testing;
using GitVersion;
using LibGit2Sharp;
Expand Down Expand Up @@ -28,7 +29,7 @@ public void CanInheritVersioningMode(VersioningMode mode)
};

var context = new GitVersionContext(mockRepository, mockBranch, config);
context.Configuration.VersioningMode.ShouldBe(mode);
context.Configurations.First().VersioningMode.ShouldBe(mode);
}

[Test]
Expand Down Expand Up @@ -59,7 +60,7 @@ public void UsesBranchSpecificConfigOverTopLevelDefaults()
}
};
var context = new GitVersionContext(mockRepository, develop, config);
context.Configuration.Tag.ShouldBe("alpha");
context.Configurations.First().Tag.ShouldBe("alpha");
}

[Test]
Expand All @@ -84,7 +85,7 @@ public void CanFindParentBranchForInheritingIncrementStrategy()
repo.Repository.MakeACommit();

var context = new GitVersionContext(repo.Repository, config);
context.Configuration.Increment.ShouldBe(IncrementStrategy.Major);
context.Configurations.First().Increment.ShouldBe(IncrementStrategy.Major);
}
}
}
Expand Down
Loading