File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
src/GitVersionCore.Tests/VersionCalculation/Strategies Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System . Collections . Generic ;
2
+ using System . Linq ;
3
+ using GitTools . Testing ;
4
+ using GitVersion . Configuration ;
5
+ using GitVersion . Extensions ;
6
+ using GitVersion . Model . Configuration ;
7
+ using GitVersion . VersionCalculation ;
8
+ using GitVersionCore . Tests . Helpers ;
9
+ using LibGit2Sharp ;
10
+ using NUnit . Framework ;
11
+ using Shouldly ;
12
+
13
+ namespace GitVersionCore . Tests . VersionCalculation . Strategies
14
+ {
15
+ [ TestFixture ]
16
+ public class TaggedCommitVersionStrategyTests : TestBase
17
+ {
18
+ [ TestCase ]
19
+ public void TagWithPreReleaseLabelShouldBeTranslatedToPreReleaseWeight ( )
20
+ {
21
+ /*todo: Extend the configuration to specify the regex & pre-release weights
22
+ for the tags.
23
+ */
24
+
25
+ using var fixture = new EmptyRepositoryFixture ( ) ;
26
+ fixture . Repository . MakeACommit ( ) ;
27
+ fixture . BranchTo ( "develop" ) ;
28
+ fixture . Repository . MakeATaggedCommit ( "v1.0.0-alpha" ) ;
29
+
30
+ var strategy = GetVersionStrategy ( fixture . Repository , "develop" ) ;
31
+ var baseVersion = strategy . GetVersions ( ) . Single ( ) ;
32
+
33
+ baseVersion . SemanticVersion . ToString ( ) . ShouldBe ( "1.0.0-1000" ) ;
34
+ }
35
+
36
+ private static IVersionStrategy GetVersionStrategy (
37
+ IRepository repository , string branch , Config config = null )
38
+ {
39
+ var sp = BuildServiceProvider ( repository , branch , config ) ;
40
+ return sp . GetServiceForType < IVersionStrategy , TaggedCommitVersionStrategy > ( ) ;
41
+ }
42
+ }
43
+ }
You can’t perform that action at this time.
0 commit comments