1
+ using GitVersion ;
2
+ using LibGit2Sharp ;
3
+ using NUnit . Framework ;
4
+
5
+ [ TestFixture ]
6
+ public class RealWorldGitFlowScenarios
7
+ {
8
+ [ Test ]
9
+ public void SupportForPrereleasesAndResetUnstableCounter ( )
10
+ {
11
+ // Note: this test checks whether the functionality explained at https://github.com/GitTools/GitVersion/issues/452 works correctly.
12
+
13
+ // This test should check the following contraints:
14
+ // 1) Can we have unstable versions
15
+ // 2) When we create a release branch, will that reset develop
16
+
17
+ var config = new Config
18
+ {
19
+ VersioningMode = VersioningMode . ContinuousDeployment
20
+ } ;
21
+
22
+ using ( var fixture = new EmptyRepositoryFixture ( config ) )
23
+ {
24
+ fixture . Repository . MakeATaggedCommit ( "2.1.0" ) ;
25
+ fixture . Repository . CreateBranch ( "develop" ) . Checkout ( ) ;
26
+ fixture . Repository . MakeACommit ( ) ;
27
+ fixture . AssertFullSemver ( "2.2.0-unstable.1" ) ;
28
+ fixture . Repository . MakeACommit ( ) ;
29
+ fixture . AssertFullSemver ( "2.2.0-unstable.2" ) ;
30
+
31
+ fixture . Repository . CreateBranch ( "release/2.2.0" ) . Checkout ( ) ;
32
+ fixture . Repository . ApplyTag ( "2.2.0" ) ;
33
+ fixture . Repository . MakeACommit ( ) ;
34
+ fixture . AssertFullSemver ( "2.2.0-beta.1" ) ;
35
+ fixture . Repository . MakeACommit ( ) ;
36
+ fixture . AssertFullSemver ( "2.2.0-beta.2" ) ;
37
+
38
+ fixture . Repository . Checkout ( "develop" ) ;
39
+ fixture . Repository . MakeACommit ( ) ;
40
+ fixture . AssertFullSemver ( "2.3.0-unstable.1" ) ;
41
+ fixture . Repository . MakeACommit ( ) ;
42
+ fixture . AssertFullSemver ( "2.3.0-unstable.2" ) ;
43
+
44
+ fixture . Repository . Checkout ( "master" ) ;
45
+ fixture . AssertFullSemver ( "2.1.0" ) ;
46
+ fixture . Repository . MergeNoFF ( "release/2.2.0" ) ;
47
+ fixture . Repository . Tags . Remove ( "2.2.0" ) ;
48
+ fixture . Repository . ApplyTag ( "2.2.0" ) ;
49
+ fixture . AssertFullSemver ( "2.2.0" ) ;
50
+
51
+ fixture . Repository . Checkout ( "develop" ) ;
52
+ fixture . Repository . MergeNoFF ( "release/2.2.0" ) ;
53
+ fixture . AssertFullSemver ( "2.3.0-unstable.3" ) ;
54
+ fixture . Repository . MakeACommit ( ) ;
55
+ fixture . AssertFullSemver ( "2.3.0-unstable.4" ) ;
56
+ fixture . Repository . MakeACommit ( ) ;
57
+
58
+ fixture . Repository . DumpGraph ( ) ;
59
+ }
60
+ }
61
+ }
0 commit comments