public void OneEntryIsCounted() { var diffs = new List <CommitDiff>() { new(Fakes.Commit().Object, Fakes.TreeEntryChanges("path/to/file").Object), }; Assert.Equal(1, CountFileChanges(diffs).Single().Count); }
public void TwoEntriesForSameFileAreCounted() { var diffs = new List <CommitDiff>() { new(Fakes.Commit().Object, Fakes.TreeEntryChanges("path/to/file").Object), new(Fakes.Commit().Object, Fakes.TreeEntryChanges("path/to/file").Object), }; Assert.Equal(2, CountFileChanges(diffs).Single().Count); }
public void TwoEntriesForTwoDifferentFilesAreCountedSeparately() { var diffs = new List <CommitDiff>() { new(Fakes.Commit().Object, Fakes.TreeEntryChanges("path/to/fileA").Object), new(Fakes.Commit().Object, Fakes.TreeEntryChanges("path/to/fileB").Object), new(Fakes.Commit().Object, Fakes.TreeEntryChanges("path/to/fileB").Object), }; Assert.Equal(1, CountFileChanges(diffs).Single(d => d.Path == "path/to/fileA").Count); Assert.Equal(2, CountFileChanges(diffs).Single(d => d.Path == "path/to/fileB").Count); }
public void RenamedFileHasHistory() { var fileA = Fakes.TreeEntryChanges("fileA"); var fileB = Fakes.TreeEntryChanges("fileB"); fileB.SetupGet(d => d.Status).Returns(ChangeKind.Renamed); fileB.SetupGet(d => d.OldPath).Returns(fileA.Object.Path); var diffs = new List <CommitDiff>() { new(Fakes.Commit().Object, fileA.Object), new(Fakes.Commit().Object, fileB.Object) }; var pathCounts = CountFileChanges(diffs); Assert.Equal("fileB", pathCounts.Single().Path); Assert.Equal(2, pathCounts.Single().Count); }