diff options
author | yorah <yoram.harmelin@gmail.com> | 2012-11-21 21:09:29 +0400 |
---|---|---|
committer | yorah <yoram.harmelin@gmail.com> | 2012-11-23 15:51:51 +0400 |
commit | 1a45367cbd4013b8aa224956b47c8257ca370684 (patch) | |
tree | 53a577a9e933406920d9ffd3bcb5f0776eb02e8e /LibGit2Sharp/TreeChanges.cs | |
parent | 247ca1a30cfb722b74ada4288bcca7293f59b87b (diff) |
Add some `DebuggerDisplay` love
I followed implementation best practices as described at http://blogs.msdn.com/b/jaredpar/archive/2011/03/18/debuggerdisplay-attribute-best-practices.aspx
Also added a Meta test to make sure the same implementation is used everywhere when using `[DebuggerDisplay]`.
Diffstat (limited to 'LibGit2Sharp/TreeChanges.cs')
-rw-r--r-- | LibGit2Sharp/TreeChanges.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/LibGit2Sharp/TreeChanges.cs b/LibGit2Sharp/TreeChanges.cs index 913836b1..f88304c2 100644 --- a/LibGit2Sharp/TreeChanges.cs +++ b/LibGit2Sharp/TreeChanges.cs @@ -1,6 +1,8 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; using System.Text; using LibGit2Sharp.Core; using LibGit2Sharp.Core.Handles; @@ -11,6 +13,7 @@ namespace LibGit2Sharp /// Holds the result of a diff between two trees. /// <para>Changes at the granularity of the file can be obtained through the different sub-collections <see cref="Added"/>, <see cref="Deleted"/> and <see cref="Modified"/>.</para> /// </summary> + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class TreeChanges : IEnumerable<TreeEntryChanges> { private readonly IDictionary<FilePath, TreeEntryChanges> changes = new Dictionary<FilePath, TreeEntryChanges>(); @@ -185,5 +188,14 @@ namespace LibGit2Sharp { get { return fullPatchBuilder.ToString(); } } + + private string DebuggerDisplay + { + get + { + return string.Format("Added: {0}, Deleted: {1}, Modified: {2}", + Added.Count(), Deleted.Count(), Modified.Count()); + } + } } } |