Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit df677af

Browse files
committed
Add test for Compare that returns TreeChanges
1 parent d95149d commit df677af

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/GitHub.Exports.UnitTests/GitServiceIntegrationTests.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.IO;
3+
using System.Linq;
34
using System.Text;
45
using System.Threading.Tasks;
56
using GitHub.Services;
@@ -41,6 +42,22 @@ public async Task Indent_Heuristic_Is_Enabled(string content1, string content2,
4142
Assert.That(patch.Content.Replace('\n', '.'), Contains.Substring(expectPatch));
4243
}
4344
}
45+
46+
[TestCase("foo", "bar")]
47+
public async Task One_File_Is_Modified(string content1, string content2)
48+
{
49+
using (var temp = new TempRepository())
50+
{
51+
var path = "foo.txt";
52+
var commit1 = AddCommit(temp.Repository, path, content1.Replace('.', '\n'));
53+
var commit2 = AddCommit(temp.Repository, path, content2.Replace('.', '\n'));
54+
var target = new GitService(new RepositoryFacade());
55+
56+
var treeChanges = await target.Compare(temp.Repository, commit1.Sha, commit2.Sha, false);
57+
58+
Assert.That(treeChanges.Modified.FirstOrDefault()?.Path, Is.EqualTo(path));
59+
}
60+
}
4461
}
4562

4663
public class TheCompareWithMethod

0 commit comments

Comments
 (0)