Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make Changes, ContentChanges and TreeEntryChanges mockable

  • Loading branch information...
commit b6274a15fd2eab1a4213291decc22eee4ed44f88 1 parent 4a5000b
@yorah yorah authored nulltoken committed
View
14 LibGit2Sharp/Changes.cs
@@ -9,6 +9,12 @@ public abstract class Changes
{
private readonly StringBuilder patchBuilder = new StringBuilder();
+ /// <summary>
+ /// Needed for mocking purposes.
+ /// </summary>
+ protected Changes()
+ { }
+
internal void AppendToPatch(string patch)
{
patchBuilder.Append(patch);
@@ -17,17 +23,17 @@ internal void AppendToPatch(string patch)
/// <summary>
/// The number of lines added.
/// </summary>
- public int LinesAdded { get; internal set; }
+ public virtual int LinesAdded { get; internal set; }
/// <summary>
/// The number of lines deleted.
/// </summary>
- public int LinesDeleted { get; internal set; }
+ public virtual int LinesDeleted { get; internal set; }
/// <summary>
/// The patch corresponding to these changes.
/// </summary>
- public string Patch
+ public virtual string Patch
{
get { return patchBuilder.ToString(); }
}
@@ -35,6 +41,6 @@ public string Patch
/// <summary>
/// Determines if at least one side of the comparison holds binary content.
/// </summary>
- public bool IsBinaryComparison { get; protected set; }
+ public virtual bool IsBinaryComparison { get; protected set; }
}
}
View
6 LibGit2Sharp/ContentChanges.cs
@@ -9,6 +9,12 @@ namespace LibGit2Sharp
/// </summary>
public class ContentChanges : Changes
{
+ /// <summary>
+ /// Needed for mocking purposes.
+ /// </summary>
+ protected ContentChanges()
+ { }
+
internal ContentChanges(Repository repo, Blob oldBlob, Blob newBlob, GitDiffOptions options)
{
using (var osw1 = new ObjectSafeWrapper(oldBlob.Id, repo))
View
20 LibGit2Sharp/TreeEntryChanges.cs
@@ -7,6 +7,12 @@ namespace LibGit2Sharp
/// </summary>
public class TreeEntryChanges : Changes
{
+ /// <summary>
+ /// Needed for mocking purposes.
+ /// </summary>
+ protected TreeEntryChanges()
+ { }
+
internal TreeEntryChanges(FilePath path, Mode mode, ObjectId oid, ChangeKind status, FilePath oldPath, Mode oldMode, ObjectId oldOid, bool isBinaryComparison)
{
Path = path.Native;
@@ -22,36 +28,36 @@ internal TreeEntryChanges(FilePath path, Mode mode, ObjectId oid, ChangeKind sta
/// <summary>
/// The new path.
/// </summary>
- public string Path { get; private set; }
+ public virtual string Path { get; private set; }
/// <summary>
/// The new <see cref="Mode"/>.
/// </summary>
- public Mode Mode { get; private set; }
+ public virtual Mode Mode { get; private set; }
/// <summary>
/// The new content hash.
/// </summary>
- public ObjectId Oid { get; private set; }
+ public virtual ObjectId Oid { get; private set; }
/// <summary>
/// The kind of change that has been done (added, deleted, modified ...).
/// </summary>
- public ChangeKind Status { get; private set; }
+ public virtual ChangeKind Status { get; private set; }
/// <summary>
/// The old path.
/// </summary>
- public string OldPath { get; private set; }
+ public virtual string OldPath { get; private set; }
/// <summary>
/// The old <see cref="Mode"/>.
/// </summary>
- public Mode OldMode { get; private set; }
+ public virtual Mode OldMode { get; private set; }
/// <summary>
/// The old content hash.
/// </summary>
- public ObjectId OldOid { get; private set; }
+ public virtual ObjectId OldOid { get; private set; }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.