File tree Expand file tree Collapse file tree 3 files changed +30
-6
lines changed
Cake.Frosting.Issues.Recipe
Cake.Frosting.Issues.Recipe.Tests/Context/State
Cake.Frosting.Issues.Recipe/Context/State
Cake.Issues.Recipe/Content/data Expand file tree Collapse file tree 3 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -69,5 +69,29 @@ DirectoryPath customProvider(IIssuesState state)
69
69
// Then
70
70
capturedState . ShouldNotBeNull ( ) . ShouldBe ( state ) ;
71
71
}
72
+
73
+ [ Fact ]
74
+ public void Should_Have_Repository_Root_Directory_Available_In_Provider_Function ( )
75
+ {
76
+ // Given
77
+ var fixture = new CakeContextFixture ( ) ;
78
+
79
+ DirectoryPath capturedRepositoryRoot = null ;
80
+ DirectoryPath customProvider ( IIssuesState state )
81
+ {
82
+ capturedRepositoryRoot = state . RepositoryRootDirectory ;
83
+ return state . BuildRootDirectory ;
84
+ }
85
+
86
+ // When
87
+ var state = new IssuesState (
88
+ fixture . CreateContext ( ) ,
89
+ RepositoryInfoProviderType . CakeGit ,
90
+ customProvider ) ;
91
+
92
+ // Then
93
+ capturedRepositoryRoot . ShouldNotBeNull ( )
94
+ . ShouldBe ( state . RepositoryRootDirectory ) ;
95
+ }
72
96
}
73
97
}
Original file line number Diff line number Diff line change @@ -76,14 +76,14 @@ public IssuesState(
76
76
this . BuildRootDirectory = context . MakeAbsolute ( context . Directory ( "./" ) ) ;
77
77
context . Information ( "Build script root directory: {0}" , this . BuildRootDirectory ) ;
78
78
79
- this . ProjectRootDirectory = projectRootDirectoryProvider ? . Invoke ( this ) ?? this . BuildRootDirectory . Combine ( ".." ) . Collapse ( ) ;
80
- context . Information ( "Project root directory: {0}" , this . ProjectRootDirectory ) ;
81
-
82
79
this . RepositoryInfo = DetermineRepositoryInfoProvider ( context , repositoryInfoProviderType ) ;
83
80
84
81
this . RepositoryRootDirectory = this . RepositoryInfo . GetRepositoryRootDirectory ( context , this . BuildRootDirectory ) ;
85
82
context . Information ( "Repository root directory: {0}" , this . RepositoryRootDirectory ) ;
86
83
84
+ this . ProjectRootDirectory = projectRootDirectoryProvider ? . Invoke ( this ) ?? this . BuildRootDirectory . Combine ( ".." ) . Collapse ( ) ;
85
+ context . Information ( "Project root directory: {0}" , this . ProjectRootDirectory ) ;
86
+
87
87
this . BuildServer = DetermineBuildServer ( context ) ;
88
88
if ( this . BuildServer != null )
89
89
{
Original file line number Diff line number Diff line change @@ -105,14 +105,14 @@ public class IssuesData
105
105
this . BuildRootDirectory = context . MakeAbsolute ( context . Directory ( "./" ) ) ;
106
106
context . Information ( "Build script root directory: {0}" , this . BuildRootDirectory ) ;
107
107
108
- this . ProjectRootDirectory = projectRootDirectoryProvider ? . Invoke ( this ) ?? this . BuildRootDirectory ;
109
- context . Information ( "Project root directory: {0}" , this . ProjectRootDirectory ) ;
110
-
111
108
this . RepositoryInfo = DetermineRepositoryInfoProvider ( context , repositoryInfoProviderType ) ;
112
109
113
110
this . RepositoryRootDirectory = context . GitFindRootFromPath ( this . BuildRootDirectory ) ;
114
111
context . Information ( "Repository root directory: {0}" , this . RepositoryRootDirectory ) ;
115
112
113
+ this . ProjectRootDirectory = projectRootDirectoryProvider ? . Invoke ( this ) ?? this . BuildRootDirectory ;
114
+ context . Information ( "Project root directory: {0}" , this . ProjectRootDirectory ) ;
115
+
116
116
this . BuildServer = DetermineBuildServer ( context ) ;
117
117
if ( this . BuildServer != null )
118
118
{
You can’t perform that action at this time.
0 commit comments