@@ -255,30 +255,33 @@ public void GetIdAsVersion_ResetsBuildNumberForEachMajorMinorVersion()
255255 [ InlineData ( "2.5" , "2.0" , - 1 ) ]
256256 public void GetIdAsVersion_Roundtrip ( string version , string assemblyVersion , int buildNumberOffset )
257257 {
258- this . WriteVersionFile ( new VersionOptions
259- {
260- Version = SemanticVersion . Parse ( version ) ,
261- AssemblyVersion = new VersionOptions . AssemblyVersionOptions ( new Version ( assemblyVersion ) ) ,
262- BuildNumberOffset = buildNumberOffset ,
263- } ) ;
258+ const string repoRelativeSubDirectory = "subdir" ;
259+ this . WriteVersionFile (
260+ new VersionOptions
261+ {
262+ Version = SemanticVersion . Parse ( version ) ,
263+ AssemblyVersion = new VersionOptions . AssemblyVersionOptions ( new Version ( assemblyVersion ) ) ,
264+ BuildNumberOffset = buildNumberOffset ,
265+ } ,
266+ repoRelativeSubDirectory ) ;
264267
265268 Commit [ ] commits = new Commit [ 16 ] ; // create enough that statistically we'll likely hit interesting bits as MSB and LSB
266269 Version [ ] versions = new Version [ commits . Length ] ;
267270 for ( int i = 0 ; i < commits . Length ; i ++ )
268271 {
269272 commits [ i ] = this . Repo . Commit ( $ "Commit { i + 1 } ", this . Signer , this . Signer , new CommitOptions { AllowEmptyCommit = true } ) ;
270- versions [ i ] = commits [ i ] . GetIdAsVersion ( ) ;
273+ versions [ i ] = commits [ i ] . GetIdAsVersion ( repoRelativeSubDirectory ) ;
271274 this . Logger . WriteLine ( $ "Commit { commits [ i ] . Id . Sha . Substring ( 0 , 8 ) } as version: { versions [ i ] } ") ;
272275 }
273276
274277 for ( int i = 0 ; i < commits . Length ; i ++ )
275278 {
276- Assert . Equal ( commits [ i ] , this . Repo . GetCommitFromVersion ( versions [ i ] ) ) ;
279+ Assert . Equal ( commits [ i ] , this . Repo . GetCommitFromVersion ( versions [ i ] , repoRelativeSubDirectory ) ) ;
277280
278281 // Also verify that we can find it without the revision number.
279282 // This is important because stable, publicly released NuGet packages
280283 // that contain no assemblies may only have major.minor.build as their version evidence.
281- Assert . Equal ( commits [ i ] , this . Repo . GetCommitFromVersion ( new Version ( versions [ i ] . Major , versions [ i ] . Minor , versions [ i ] . Build ) ) ) ;
284+ Assert . Equal ( commits [ i ] , this . Repo . GetCommitFromVersion ( new Version ( versions [ i ] . Major , versions [ i ] . Minor , versions [ i ] . Build ) , repoRelativeSubDirectory ) ) ;
282285 }
283286 }
284287
0 commit comments