@@ -548,12 +548,11 @@ public void CalculateVersionVariables_TwoBranchHasSameCommitHeadDetachedAndNotTa
548548 {
549549 // Setup
550550 using var fixture = new RemoteRepositoryFixture ( ) ;
551- var repoDir = new DirectoryInfo ( fixture . RepositoryPath ) ;
552- var Init = fixture . LocalRepositoryFixture . Repository . MakeACommit ( "Init commit" ) ;
553- var branchV1 = fixture . LocalRepositoryFixture . Repository . CreateBranch ( "feature/1.0" ) ;
551+ fixture . LocalRepositoryFixture . Repository . MakeACommit ( "Init commit" ) ;
552+ fixture . LocalRepositoryFixture . Repository . CreateBranch ( "feature/1.0" ) ;
554553 fixture . LocalRepositoryFixture . Checkout ( "feature/1.0" ) ;
555554 var commit = fixture . LocalRepositoryFixture . Repository . MakeACommit ( "feat: a new commit" ) ;
556- var branchV2 = fixture . LocalRepositoryFixture . Repository . CreateBranch ( "support/1.0" ) ;
555+ fixture . LocalRepositoryFixture . Repository . CreateBranch ( "support/1.0" ) ;
557556 fixture . LocalRepositoryFixture . Checkout ( commit . Sha ) ;
558557
559558 using var worktreeFixture = new LocalRepositoryFixture ( new Repository ( fixture . LocalRepositoryFixture . RepositoryPath ) ) ;
@@ -564,15 +563,13 @@ public void CalculateVersionVariables_TwoBranchHasSameCommitHeadDetachedAndNotTa
564563
565564 this . sp = GetServiceProvider ( gitVersionOptions , environment : environment ) ;
566565
567- var lazyContext = this . sp . GetService < Lazy < GitVersionContext > > ( ) ;
568- var context = lazyContext . Value ;
566+ var _ = this . sp . GetService < Lazy < GitVersionContext > > ( ) ? . Value ;
569567
570- var preparer = this . sp . GetService < IGitPreparer > ( ) ;
571568 var sut = sp . GetService < IGitVersionCalculateTool > ( ) ;
572569
573570 // Execute & Verify
574- var exception = Assert . Throws < WarningException > ( ( ) => sut . CalculateVersionVariables ( ) ) ;
575- exception . Message . ShouldBe ( "Failed to try and guess branch to use. Move one of the branches along a commit to remove warning" ) ;
571+ var exception = Assert . Throws < WarningException > ( ( ) => sut ! . CalculateVersionVariables ( ) ) ;
572+ exception ! . Message . ShouldBe ( "Failed to try and guess branch to use. Move one of the branches along a commit to remove warning" ) ;
576573 }
577574
578575 [ Test ]
@@ -582,12 +579,11 @@ public void CalculateVersionVariables_TwoBranchHasSameCommitHeadDetachedAndTagge
582579 {
583580 // Setup
584581 using var fixture = new RemoteRepositoryFixture ( ) ;
585- var repoDir = new DirectoryInfo ( fixture . RepositoryPath ) ;
586- var Init = fixture . LocalRepositoryFixture . Repository . MakeACommit ( "Init commit" ) ;
587- var branchV1 = fixture . LocalRepositoryFixture . Repository . CreateBranch ( "feature/1.0" ) ;
582+ fixture . LocalRepositoryFixture . Repository . MakeACommit ( "Init commit" ) ;
583+ fixture . LocalRepositoryFixture . Repository . CreateBranch ( "feature/1.0" ) ;
588584 fixture . LocalRepositoryFixture . Checkout ( "feature/1.0" ) ;
589585 var commit = fixture . LocalRepositoryFixture . Repository . MakeACommit ( "feat: a new commit" ) ;
590- var branchV2 = fixture . LocalRepositoryFixture . Repository . CreateBranch ( "support/1.0" ) ;
586+ fixture . LocalRepositoryFixture . Repository . CreateBranch ( "support/1.0" ) ;
591587 fixture . LocalRepositoryFixture . ApplyTag ( "1.0.1" ) ;
592588 fixture . LocalRepositoryFixture . Checkout ( commit . Sha ) ;
593589
@@ -599,14 +595,12 @@ public void CalculateVersionVariables_TwoBranchHasSameCommitHeadDetachedAndTagge
599595
600596 this . sp = GetServiceProvider ( gitVersionOptions , environment : environment ) ;
601597
602- var lazyContext = this . sp . GetService < Lazy < GitVersionContext > > ( ) ;
603- var context = lazyContext . Value ;
598+ var _ = this . sp . GetService < Lazy < GitVersionContext > > ( ) ? . Value ;
604599
605- var preparer = this . sp . GetService < IGitPreparer > ( ) ;
606600 var sut = sp . GetService < IGitVersionCalculateTool > ( ) ;
607601
608602 // Execute
609- var version = sut . CalculateVersionVariables ( ) ;
603+ var version = sut ! . CalculateVersionVariables ( ) ;
610604
611605 // Verify
612606 version . SemVer . ShouldBe ( "1.0.1" ) ;
@@ -633,7 +627,7 @@ private static IServiceProvider GetServiceProvider(GitVersionOptions gitVersionO
633627 {
634628 var options = sp . GetService < IOptions < GitVersionOptions > > ( ) ;
635629 var contextFactory = sp . GetService < IGitVersionContextFactory > ( ) ;
636- return new Lazy < GitVersionContext ? > ( ( ) => contextFactory ? . Create ( options ? . Value ) ) ;
630+ return new Lazy < GitVersionContext > ( ( ) => contextFactory ? . Create ( options ? . Value ) ) ;
637631 } ) ;
638632 if ( log != null ) services . AddSingleton ( log ) ;
639633 if ( fileSystem != null ) services . AddSingleton ( fileSystem ) ;
0 commit comments