@@ -68,6 +68,7 @@ public async Task GetBuildVersion_In_Git_But_Without_Commits()
6868 Repository . Init ( this . RepoPath ) ;
6969 var repo = new Repository ( this . RepoPath ) ; // do not assign Repo property to avoid commits being generated later
7070 this . WriteVersionFile ( "3.4" ) ;
71+ Assumes . False ( repo . Head . Commits . Any ( ) ) ; // verification that the test is doing what it claims
7172 var buildResult = await this . BuildAsync ( ) ;
7273 Assert . Equal ( "3.4" , buildResult . BuildVersion ) ;
7374 Assert . Equal ( "3.4.0" , buildResult . AssemblyInformationalVersion ) ;
@@ -80,6 +81,18 @@ public async Task GetBuildVersion_In_Git_But_Head_Lacks_VersionFile()
8081 var repo = new Repository ( this . RepoPath ) ; // do not assign Repo property to avoid commits being generated later
8182 repo . Commit ( "empty" , this . Signer , this . Signer , new CommitOptions { AllowEmptyCommit = true } ) ;
8283 this . WriteVersionFile ( "3.4" ) ;
84+ Assumes . True ( repo . Index [ VersionFile . JsonFileName ] == null ) ;
85+ var buildResult = await this . BuildAsync ( ) ;
86+ Assert . Equal ( "0.0.1." + repo . Head . Commits . First ( ) . GetIdAsVersion ( ) . Revision , buildResult . BuildVersion ) ;
87+ Assert . Equal ( "0.0.1+g" + repo . Head . Commits . First ( ) . Id . Sha . Substring ( 0 , 10 ) , buildResult . AssemblyInformationalVersion ) ;
88+ }
89+
90+ [ Fact ]
91+ public async Task GetBuildVersion_In_Git_No_VersionFile_At_All ( )
92+ {
93+ Repository . Init ( this . RepoPath ) ;
94+ var repo = new Repository ( this . RepoPath ) ; // do not assign Repo property to avoid commits being generated later
95+ repo . Commit ( "empty" , this . Signer , this . Signer , new CommitOptions { AllowEmptyCommit = true } ) ;
8396 var buildResult = await this . BuildAsync ( ) ;
8497 Assert . Equal ( "0.0.1." + repo . Head . Commits . First ( ) . GetIdAsVersion ( ) . Revision , buildResult . BuildVersion ) ;
8598 Assert . Equal ( "0.0.1+g" + repo . Head . Commits . First ( ) . Id . Sha . Substring ( 0 , 10 ) , buildResult . AssemblyInformationalVersion ) ;
0 commit comments