示例#1
0
        public void CanTakeVersionFromBranchName(string branchName, string expectedBaseVersion)
        {
            using (var fixture = new EmptyRepositoryFixture())
            {
                fixture.Repository.MakeACommit();
                var branch = fixture.Repository.CreateBranch(branchName);
                var sut    = new VersionInBranchBaseVersionStrategy();

                var gitVersionContext = new GitVersionContext(fixture.Repository, branch, new Config().ApplyDefaults());
                var baseVersion       = sut.GetVersions(gitVersionContext).SingleOrDefault();

                if (expectedBaseVersion == null)
                {
                    baseVersion.ShouldBe(null);
                }
                else
                {
                    baseVersion.SemanticVersion.ToString().ShouldBe(expectedBaseVersion);
                }
            }
        }