Skip to content

Commit 27f78bd

Browse files
committed
Fix unit tests
1 parent 044f94f commit 27f78bd

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

GitContentSearch.Tests/GitContentSearch.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<ItemGroup>
1313
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
1414
<PackageReference Include="Moq" Version="4.20.70" />
15-
<PackageReference Include="xunit" Version="2.9.0" />
16-
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
15+
<PackageReference Include="xunit" Version="2.4.2" />
16+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
1717
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1818
<PrivateAssets>all</PrivateAssets>
1919
</PackageReference>

GitContentSearch.Tests/GitContentSearcherTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void SearchContent_ShouldLogFirstAndLastAppearance_Correctly()
1717

1818
// Simulate commits
1919
var commits = new[] { "commit5", "commit4", "commit3", "commit2", "commit1" };
20-
gitHelperMock.Setup(g => g.GetGitCommits(It.IsAny<string>(), It.IsAny<string>())).Returns(commits);
20+
gitHelperMock.Setup(g => g.GetGitCommits(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())).Returns(commits);
2121
gitHelperMock.Setup(g => g.GetCommitTime(It.IsAny<string>())).Returns("2023-08-21 12:00:00");
2222

2323
// Simulate string appearances based on the specific commit
@@ -51,7 +51,7 @@ public void SearchContent_ShouldLogCorrectly_WhenStringNotFound()
5151

5252
// Simulate commits
5353
var commits = new[] { "commit1", "commit2", "commit3", "commit4", "commit5" };
54-
gitHelperMock.Setup(g => g.GetGitCommits(It.IsAny<string>(), It.IsAny<string>())).Returns(commits);
54+
gitHelperMock.Setup(g => g.GetGitCommits(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())).Returns(commits);
5555
gitHelperMock.Setup(g => g.GetCommitTime(It.IsAny<string>())).Returns("2023-08-21 12:00:00");
5656

5757
// Simulate no appearances of the string
@@ -80,7 +80,7 @@ public void SearchContent_ShouldLogCorrectly_WhenStringAppearsInSingleCommit()
8080

8181
// Simulate commits
8282
var commits = new[] { "commit1", "commit2", "commit3", "commit4", "commit5" };
83-
gitHelperMock.Setup(g => g.GetGitCommits(It.IsAny<string>(), It.IsAny<string>())).Returns(commits);
83+
gitHelperMock.Setup(g => g.GetGitCommits(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())).Returns(commits);
8484
gitHelperMock.Setup(g => g.GetCommitTime(It.IsAny<string>())).Returns("2023-08-21 12:00:00");
8585

8686
// Simulate string appearance: Found only in commit3
@@ -117,8 +117,8 @@ public void SearchContent_ShouldRestrictSearchToSpecifiedCommitRange()
117117
var restrictedCommits = new[] { "commit3", "commit2" };
118118

119119
// Mock the GetGitCommits method to return only the restricted range when specified
120-
gitHelperMock.Setup(g => g.GetGitCommits("commit2", "commit3")).Returns(restrictedCommits);
121-
gitHelperMock.Setup(g => g.GetGitCommits(It.Is<string>(s => s != "commit2"), It.Is<string>(s => s != "commit3"))).Returns(allCommits);
120+
gitHelperMock.Setup(g => g.GetGitCommits("commit2", "commit3", It.IsAny<string>())).Returns(restrictedCommits);
121+
gitHelperMock.Setup(g => g.GetGitCommits(It.Is<string>(s => s != "commit2"), It.Is<string>(s => s != "commit3"), It.IsAny<string>())).Returns(allCommits);
122122

123123
gitHelperMock.Setup(g => g.GetCommitTime(It.IsAny<string>())).Returns("2023-08-21 12:00:00");
124124

@@ -162,7 +162,7 @@ public void SearchContent_ShouldLogError_WhenEarliestCommitIsMoreRecentThanLates
162162
var allCommits = new[] { "commit5", "commit4", "commit3", "commit2", "commit1" };
163163

164164
// Mock the GetGitCommits method
165-
gitHelperMock.Setup(g => g.GetGitCommits(It.IsAny<string>(), It.IsAny<string>())).Returns(allCommits);
165+
gitHelperMock.Setup(g => g.GetGitCommits(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())).Returns(allCommits);
166166
gitHelperMock.Setup(g => g.GetCommitTime(It.IsAny<string>())).Returns("2023-08-21 12:00:00");
167167

168168
using (var stringWriter = new StringWriter())

GitContentSearch.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ VisualStudioVersion = 17.8.34511.84
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitContentSearch", "GitContentSearch\GitContentSearch.csproj", "{04D34493-4172-4959-938B-6E674CB0806B}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitContentSearch.Tests", "GitContentSearch.Tests\GitContentSearch.Tests.csproj", "{AA41E515-B4F9-41EF-A542-751FCE4AF023}"
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitContentSearch.Tests", "GitContentSearch.Tests\GitContentSearch.Tests.csproj", "{AA41E515-B4F9-41EF-A542-751FCE4AF023}"
99
EndProject
1010
Global
1111
GlobalSection(SolutionConfigurationPlatforms) = preSolution

0 commit comments

Comments
 (0)