@@ -17,6 +17,12 @@ public class Commit : GitObject
17
17
private readonly Lazy < string > shortMessage ;
18
18
private readonly Lazy < IEnumerable < Note > > notes ;
19
19
20
+ /// <summary>
21
+ /// Needed for mocking purposes.
22
+ /// </summary>
23
+ protected Commit ( )
24
+ { }
25
+
20
26
internal Commit ( ObjectId id , ObjectId treeId , Repository repo )
21
27
: base ( id )
22
28
{
@@ -32,20 +38,20 @@ internal Commit(ObjectId id, ObjectId treeId, Repository repo)
32
38
/// </summary>
33
39
/// <param name = "relativePath">The relative path to the <see cref = "TreeEntry" /> from the <see cref = "Commit" /> working directory.</param>
34
40
/// <returns><c>null</c> if nothing has been found, the <see cref = "TreeEntry" /> otherwise.</returns>
35
- public TreeEntry this [ string relativePath ]
41
+ public virtual TreeEntry this [ string relativePath ]
36
42
{
37
43
get { return Tree [ relativePath ] ; }
38
44
}
39
45
40
46
/// <summary>
41
47
/// Gets the commit message.
42
48
/// </summary>
43
- public string Message { get ; private set ; }
49
+ public virtual string Message { get ; private set ; }
44
50
45
51
/// <summary>
46
52
/// Gets the short commit message which is usually the first line of the commit.
47
53
/// </summary>
48
- public string MessageShort
54
+ public virtual string MessageShort
49
55
{
50
56
get { return shortMessage . Value ; }
51
57
}
@@ -63,30 +69,30 @@ private string ExtractShortMessage()
63
69
/// <summary>
64
70
/// Gets the encoding of the message.
65
71
/// </summary>
66
- public string Encoding { get ; private set ; }
72
+ public virtual string Encoding { get ; private set ; }
67
73
68
74
/// <summary>
69
75
/// Gets the author of this commit.
70
76
/// </summary>
71
- public Signature Author { get ; private set ; }
77
+ public virtual Signature Author { get ; private set ; }
72
78
73
79
/// <summary>
74
80
/// Gets the committer.
75
81
/// </summary>
76
- public Signature Committer { get ; private set ; }
82
+ public virtual Signature Committer { get ; private set ; }
77
83
78
84
/// <summary>
79
85
/// Gets the Tree associated to this commit.
80
86
/// </summary>
81
- public Tree Tree
87
+ public virtual Tree Tree
82
88
{
83
89
get { return tree . Value ; }
84
90
}
85
91
86
92
/// <summary>
87
93
/// Gets the parents of this commit. This property is lazy loaded and can throw an exception if the commit no longer exists in the repo.
88
94
/// </summary>
89
- public IEnumerable < Commit > Parents
95
+ public virtual IEnumerable < Commit > Parents
90
96
{
91
97
get { return parents . Value ; }
92
98
}
0 commit comments