From c9838662dcb0c7f94809fca94c441344b73914fe Mon Sep 17 00:00:00 2001 From: Kristian Hellang Date: Tue, 6 Jan 2015 01:06:03 +0100 Subject: [PATCH] Fixed failing DebuggerDisplay tests --- .../Models/Request/SearchRepositoriesRequest.cs | 12 ++++++++++++ Octokit/Models/Response/Application.cs | 14 ++++++++++++-- Octokit/Models/Response/FeedLink.cs | 15 ++++++++++++++- Octokit/Models/Response/NotificationInfo.cs | 11 ++++++++++- Octokit/Models/Response/Plan.cs | 12 +++++++++++- Octokit/Models/Response/TagObject.cs | 8 ++++++-- 6 files changed, 65 insertions(+), 7 deletions(-) diff --git a/Octokit/Models/Request/SearchRepositoriesRequest.cs b/Octokit/Models/Request/SearchRepositoriesRequest.cs index 560c2b81..3b9a63fc 100644 --- a/Octokit/Models/Request/SearchRepositoriesRequest.cs +++ b/Octokit/Models/Request/SearchRepositoriesRequest.cs @@ -176,6 +176,7 @@ namespace Octokit /// /// Helper class in generating the range values for a qualifer e.g. In or Size qualifiers /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class Range { private string query = string.Empty; @@ -220,6 +221,11 @@ namespace Octokit } } + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Query: {0}", query); } + } + /// /// Helper class that build a with a LessThan comparator used for filtering results /// @@ -262,6 +268,7 @@ namespace Octokit /// helper class in generating the date range values for the date qualifier e.g. /// https://help.github.com/articles/searching-repositories#created-and-last-updated /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class DateRange { private readonly string query = string.Empty; @@ -289,6 +296,11 @@ namespace Octokit } } + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Query: {0}", query); } + } + /// /// helper method to create a LessThan Date Comparision /// e.g. < 2011 diff --git a/Octokit/Models/Response/Application.cs b/Octokit/Models/Response/Application.cs index 0d7312c5..0f75a0a4 100644 --- a/Octokit/Models/Response/Application.cs +++ b/Octokit/Models/Response/Application.cs @@ -1,8 +1,13 @@ -namespace Octokit +using System; +using System.Diagnostics; +using System.Globalization; + +namespace Octokit { /// /// Represents an oauth application. /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class Application { /// @@ -14,5 +19,10 @@ /// The Url of this . /// public string Url { get; protected set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Name: {0}", Name); } + } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/FeedLink.cs b/Octokit/Models/Response/FeedLink.cs index 87183fd7..899c1c28 100644 --- a/Octokit/Models/Response/FeedLink.cs +++ b/Octokit/Models/Response/FeedLink.cs @@ -1,11 +1,13 @@ using System; using System.Diagnostics; +using System.Globalization; namespace Octokit { /// /// Collection of feeds including both url and type /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class FeedLinks { /// @@ -35,13 +37,19 @@ namespace Octokit /// /// The private timeline for the authenticated user for a given organization, using URI template - /// + /// public FeedLink CurrentUserOrganization { get; protected set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Timeline: {0}, User: {1}, CurrentUser: {2}", Timeline, User, CurrentUser); } + } } /// /// Feed information including feed url and feed type /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class FeedLink { /// @@ -54,5 +62,10 @@ namespace Octokit /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")] public string Type { get; protected set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Type: {0}, Href: {1}", Type, Href); } + } } } \ No newline at end of file diff --git a/Octokit/Models/Response/NotificationInfo.cs b/Octokit/Models/Response/NotificationInfo.cs index 65ea31a8..814946ca 100644 --- a/Octokit/Models/Response/NotificationInfo.cs +++ b/Octokit/Models/Response/NotificationInfo.cs @@ -1,7 +1,11 @@ -using System.Diagnostics.CodeAnalysis; +using System; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; namespace Octokit { + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class NotificationInfo { public string Title { get; protected set; } @@ -13,5 +17,10 @@ namespace Octokit [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Justification = "Matches the property name used by the API")] public string Type { get; protected set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Type: {0}, Title: {1}", Type, Title); } + } } } diff --git a/Octokit/Models/Response/Plan.cs b/Octokit/Models/Response/Plan.cs index 6d285a30..9fe2974e 100644 --- a/Octokit/Models/Response/Plan.cs +++ b/Octokit/Models/Response/Plan.cs @@ -1,8 +1,13 @@ +using System; +using System.Diagnostics; +using System.Globalization; + namespace Octokit { /// /// A plan (either paid or free) for a particular user /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class Plan { /// @@ -32,5 +37,10 @@ namespace Octokit /// The billing email for the organization. Only has a value in response to editing an organization. /// public string BillingEmail { get; protected set; } + + internal string DebuggerDisplay + { + get { return String.Format(CultureInfo.InvariantCulture, "Name: {0}, Space: {1}, Private Repos: {2}, Collaborators: {3}", Name, Space, PrivateRepos, Collaborators); } + } } -} \ No newline at end of file +} diff --git a/Octokit/Models/Response/TagObject.cs b/Octokit/Models/Response/TagObject.cs index 85652276..b08fc5b3 100644 --- a/Octokit/Models/Response/TagObject.cs +++ b/Octokit/Models/Response/TagObject.cs @@ -1,8 +1,12 @@ -namespace Octokit +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; + +namespace Octokit { + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class TagObject : GitReference { - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", + [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Justification = "Name defined by web api and required for deserialisation")] public TaggedType Type { get; protected set; } }