44using System . IO ;
55using Xunit ;
66using LibGit2Sharp ;
7+ using System . Threading ;
78
89namespace GitContentSearch . Tests
910{
@@ -29,6 +30,8 @@ public void GetGitCommits_ShouldReturnEmptyList_OnGitFailure()
2930
3031 var processResult = new ProcessResult ( string . Empty , "Error occurred" , 1 ) ;
3132 processWrapperMock . Setup ( pw => pw . Start ( It . IsAny < ProcessStartInfo > ( ) , null ) ) . Returns ( processResult ) ;
33+ processWrapperMock . Setup ( pw => pw . Start ( It . IsAny < string > ( ) , It . IsAny < string > ( ) , It . IsAny < Stream > ( ) , It . IsAny < CancellationToken > ( ) ) )
34+ . Returns ( processResult ) ;
3235
3336 var gitHelper = new GitHelper ( processWrapperMock . Object ) ;
3437
@@ -77,7 +80,8 @@ public void GetGitCommits_ShouldReturnCorrectRange_WhenBothCommitsArePresent()
7780
7881 var gitLogOutput = "commit5\n commit4\n commit3\n commit2\n commit1" ;
7982 var processResult = new ProcessResult ( gitLogOutput , string . Empty , 0 ) ;
80- processWrapperMock . Setup ( pw => pw . Start ( It . Is < string > ( x => x . Trim ( ) == "log --pretty=format:%H" ) , null , null ) ) . Returns ( processResult ) ;
83+ processWrapperMock . Setup ( pw => pw . Start ( It . Is < string > ( x => x . Trim ( ) == "log --pretty=format:%H" ) , It . IsAny < string > ( ) , It . IsAny < Stream > ( ) , It . IsAny < CancellationToken > ( ) ) )
84+ . Returns ( processResult ) ;
8185
8286 var gitHelper = new GitHelper ( processWrapperMock . Object ) ;
8387
@@ -103,7 +107,8 @@ public void GetGitCommits_ShouldReturnFullRange_WhenEarliestAndLatestAreEmpty()
103107
104108 var gitLogOutput = "commit5\n commit4\n commit3\n commit2\n commit1" ;
105109 var processResult = new ProcessResult ( gitLogOutput , string . Empty , 0 ) ;
106- processWrapperMock . Setup ( pw => pw . Start ( It . Is < string > ( x => x . Trim ( ) == "log --pretty=format:%H" ) , null , null ) ) . Returns ( processResult ) ;
110+ processWrapperMock . Setup ( pw => pw . Start ( It . Is < string > ( x => x . Trim ( ) == "log --pretty=format:%H" ) , It . IsAny < string > ( ) , It . IsAny < Stream > ( ) , It . IsAny < CancellationToken > ( ) ) )
111+ . Returns ( processResult ) ;
107112
108113 var gitHelper = new GitHelper ( processWrapperMock . Object ) ;
109114
@@ -131,7 +136,8 @@ public void GetGitCommits_ShouldReturnPartialRange_WhenOnlyEarliestCommitIsSpeci
131136
132137 var gitLogOutput = "commit5\n commit4\n commit3\n commit2\n commit1" ;
133138 var processResult = new ProcessResult ( gitLogOutput , string . Empty , 0 ) ;
134- processWrapperMock . Setup ( pw => pw . Start ( It . Is < string > ( x => x . Trim ( ) == "log --pretty=format:%H" ) , null , null ) ) . Returns ( processResult ) ;
139+ processWrapperMock . Setup ( pw => pw . Start ( It . Is < string > ( x => x . Trim ( ) == "log --pretty=format:%H" ) , It . IsAny < string > ( ) , It . IsAny < Stream > ( ) , It . IsAny < CancellationToken > ( ) ) )
140+ . Returns ( processResult ) ;
135141
136142 var gitHelper = new GitHelper ( processWrapperMock . Object ) ;
137143
@@ -157,7 +163,8 @@ public void GetGitCommits_ShouldReturnPartialRange_WhenOnlyLatestCommitIsSpecifi
157163
158164 var gitLogOutput = "commit5\n commit4\n commit3\n commit2\n commit1" ;
159165 var processResult = new ProcessResult ( gitLogOutput , string . Empty , 0 ) ;
160- processWrapperMock . Setup ( pw => pw . Start ( It . Is < string > ( x => x . Trim ( ) == "log --pretty=format:%H" ) , null , null ) ) . Returns ( processResult ) ;
166+ processWrapperMock . Setup ( pw => pw . Start ( It . Is < string > ( x => x . Trim ( ) == "log --pretty=format:%H" ) , It . IsAny < string > ( ) , It . IsAny < Stream > ( ) , It . IsAny < CancellationToken > ( ) ) )
167+ . Returns ( processResult ) ;
161168
162169 var gitHelper = new GitHelper ( processWrapperMock . Object ) ;
163170
@@ -183,7 +190,8 @@ public void GetGitCommits_ShouldReturnEmptyList_WhenCommitsAreInWrongOrder()
183190
184191 var gitLogOutput = "commit5\n commit4\n commit3\n commit2\n commit1" ;
185192 var processResult = new ProcessResult ( gitLogOutput , string . Empty , 0 ) ;
186- processWrapperMock . Setup ( pw => pw . Start ( It . IsAny < ProcessStartInfo > ( ) , null ) ) . Returns ( processResult ) ;
193+ processWrapperMock . Setup ( pw => pw . Start ( It . IsAny < string > ( ) , It . IsAny < string > ( ) , It . IsAny < Stream > ( ) , It . IsAny < CancellationToken > ( ) ) )
194+ . Returns ( processResult ) ;
187195
188196 var gitHelper = new GitHelper ( processWrapperMock . Object ) ;
189197
@@ -202,7 +210,8 @@ public void GetGitCommits_ShouldReturnEmptyList_WhenEarliestCommitIsNotFound()
202210
203211 var gitLogOutput = "commit5\n commit4\n commit3\n commit2\n commit1" ;
204212 var processResult = new ProcessResult ( gitLogOutput , string . Empty , 0 ) ;
205- processWrapperMock . Setup ( pw => pw . Start ( It . IsAny < ProcessStartInfo > ( ) , null ) ) . Returns ( processResult ) ;
213+ processWrapperMock . Setup ( pw => pw . Start ( It . IsAny < string > ( ) , It . IsAny < string > ( ) , It . IsAny < Stream > ( ) , It . IsAny < CancellationToken > ( ) ) )
214+ . Returns ( processResult ) ;
206215
207216 var gitHelper = new GitHelper ( processWrapperMock . Object ) ;
208217
@@ -221,7 +230,8 @@ public void GetGitCommits_ShouldReturnEmptyList_WhenLatestCommitIsNotFound()
221230
222231 var gitLogOutput = "commit5\n commit4\n commit3\n commit2\n commit1" ;
223232 var processResult = new ProcessResult ( gitLogOutput , string . Empty , 0 ) ;
224- processWrapperMock . Setup ( pw => pw . Start ( It . IsAny < ProcessStartInfo > ( ) , null ) ) . Returns ( processResult ) ;
233+ processWrapperMock . Setup ( pw => pw . Start ( It . IsAny < string > ( ) , It . IsAny < string > ( ) , It . IsAny < Stream > ( ) , It . IsAny < CancellationToken > ( ) ) )
234+ . Returns ( processResult ) ;
225235
226236 var gitHelper = new GitHelper ( processWrapperMock . Object ) ;
227237
@@ -254,8 +264,8 @@ public void GetCommits_ShouldFormatFilePath_Correctly(string inputPath, string e
254264 // Setup mock to capture the actual command
255265 string ? capturedCommand = null ;
256266 processWrapperMock
257- . Setup ( pw => pw . Start ( It . IsAny < string > ( ) , It . IsAny < string > ( ) , It . IsAny < Stream > ( ) ) )
258- . Callback < string , string ? , Stream ? > ( ( cmd , dir , stream ) => capturedCommand = cmd )
267+ . Setup ( pw => pw . Start ( It . IsAny < string > ( ) , It . IsAny < string > ( ) , It . IsAny < Stream > ( ) , It . IsAny < CancellationToken > ( ) ) )
268+ . Callback < string , string ? , Stream ? , CancellationToken > ( ( cmd , dir , stream , token ) => capturedCommand = cmd )
259269 . Returns ( new ProcessResult ( string . Empty , string . Empty , 0 ) ) ;
260270
261271 // Act
@@ -278,8 +288,8 @@ public void GetCommitsWithFollow_ShouldFormatFilePath_Correctly(string inputPath
278288 // Setup mock to capture the actual command
279289 string ? capturedCommand = null ;
280290 processWrapperMock
281- . Setup ( pw => pw . Start ( It . IsAny < string > ( ) , It . IsAny < string > ( ) , It . IsAny < Stream > ( ) ) )
282- . Callback < string , string ? , Stream ? > ( ( cmd , dir , stream ) => capturedCommand = cmd )
291+ . Setup ( pw => pw . Start ( It . IsAny < string > ( ) , It . IsAny < string > ( ) , It . IsAny < Stream > ( ) , It . IsAny < CancellationToken > ( ) ) )
292+ . Callback < string , string ? , Stream ? , CancellationToken > ( ( cmd , dir , stream , token ) => capturedCommand = cmd )
283293 . Returns ( new ProcessResult ( string . Empty , string . Empty , 0 ) ) ;
284294
285295 // Act
0 commit comments