forked from libgit2/libgit2sharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatchStatsFixture.cs
More file actions
27 lines (24 loc) · 874 Bytes
/
PatchStatsFixture.cs
File metadata and controls
27 lines (24 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using LibGit2Sharp.Tests.TestHelpers;
using Xunit;
namespace LibGit2Sharp.Tests
{
public class PatchStatsFixture : BaseFixture
{
[Fact]
public void CanExtractStatisticsFromDiff()
{
var path = SandboxStandardTestRepoGitDir();
using (var repo = new Repository(path))
{
var oldTree = repo.Lookup<Commit>("origin/packed-test").Tree;
var newTree = repo.Lookup<Commit>("HEAD").Tree;
var stats = repo.Diff.Compare<PatchStats>(oldTree, newTree);
Assert.Equal(8, stats.TotalLinesAdded);
Assert.Equal(1, stats.TotalLinesDeleted);
var contentStats = stats["new.txt"];
Assert.Equal(1, contentStats.LinesAdded);
Assert.Equal(1, contentStats.LinesDeleted);
}
}
}
}