From ae23a2ae7ad08f17da1e18b1843d7e2def4aa827 Mon Sep 17 00:00:00 2001 From: Kristian Hellang Date: Sun, 1 Dec 2013 23:25:41 +0100 Subject: [PATCH] Fixed minor namespace and whitespace issues --- .../Clients/IObservableGistCommentsClient.cs | 12 +- .../Clients/IObservableGistsClient.cs | 2 +- .../Clients/IObservableIssuesEventsClient.cs | 6 +- .../Clients/IObservableMilestonesClient.cs | 3 +- .../Clients/ObservableGistCommentsClient.cs | 13 +- .../Clients/ObservableGistsClient.cs | 10 +- .../Clients/ObservableIssuesClient.cs | 2 - .../Clients/ObservableIssuesEventsClient.cs | 3 +- .../Clients/ObservableMilestonesClient.cs | 2 +- .../Clients/ObservableNotificationsClient.cs | 2 +- .../Clients/ObservableStarredClient.cs | 4 +- Octokit.Reactive/IObservableGitHubClient.cs | 4 +- Octokit.Reactive/ObservableGitHubClient.cs | 1 - .../Octokit.Reactive.csproj.DotSettings | 2 + .../ObservableMilestonesClientTests.cs | 2 +- .../Clients/GistCommentsClientTests.cs | 167 +++++++++--------- .../ObservableMilestonesClientTests.cs | 2 +- .../Reactive/ObservableStarredClientTests.cs | 2 +- 18 files changed, 116 insertions(+), 123 deletions(-) create mode 100644 Octokit.Reactive/Octokit.Reactive.csproj.DotSettings diff --git a/Octokit.Reactive/Clients/IObservableGistCommentsClient.cs b/Octokit.Reactive/Clients/IObservableGistCommentsClient.cs index 96746baa..2d7372a5 100644 --- a/Octokit.Reactive/Clients/IObservableGistCommentsClient.cs +++ b/Octokit.Reactive/Clients/IObservableGistCommentsClient.cs @@ -2,7 +2,7 @@ using System.Diagnostics.CodeAnalysis; using System.Reactive; -namespace Octokit.Reactive.Clients +namespace Octokit.Reactive { public interface IObservableGistCommentsClient { @@ -12,7 +12,7 @@ namespace Octokit.Reactive.Clients /// http://developer.github.com/v3/gists/comments/#get-a-single-comment /// The id of the gist /// The id of the comment - /// Task{GistComment}. + /// IObservable{GistComment}. [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", Justification = "Method makes a network request")] IObservable Get(int gistId, int commentId); @@ -22,7 +22,7 @@ namespace Octokit.Reactive.Clients /// /// http://developer.github.com/v3/gists/comments/#list-comments-on-a-gist /// The id of the gist - /// Task{IReadOnlyList{GistComment}}. + /// IObservable{GistComment}. IObservable GetForGist(int gistId); /// @@ -31,7 +31,7 @@ namespace Octokit.Reactive.Clients /// http://developer.github.com/v3/gists/comments/#create-a-comment /// The id of the gist /// The body of the comment - /// Task{GistComment}. + /// IObservable{GistComment}. IObservable Create(int gistId, string comment); /// @@ -41,7 +41,7 @@ namespace Octokit.Reactive.Clients /// The id of the gist /// The id of the comment /// The updated body of the comment - /// Task{GistComment}. + /// IObservable{GistComment}. IObservable Update(int gistId, int commentId, string comment); /// @@ -50,7 +50,7 @@ namespace Octokit.Reactive.Clients /// http://developer.github.com/v3/gists/comments/#delete-a-comment /// The id of the gist /// The id of the comment - /// Task. + /// IObservable{Unit}. IObservable Delete(int gistId, int commentId); } } \ No newline at end of file diff --git a/Octokit.Reactive/Clients/IObservableGistsClient.cs b/Octokit.Reactive/Clients/IObservableGistsClient.cs index c8a568cc..5bb29ede 100644 --- a/Octokit.Reactive/Clients/IObservableGistsClient.cs +++ b/Octokit.Reactive/Clients/IObservableGistsClient.cs @@ -1,7 +1,7 @@ using System; using System.Diagnostics.CodeAnalysis; -namespace Octokit.Reactive.Clients +namespace Octokit.Reactive { public interface IObservableGistsClient { diff --git a/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs b/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs index 58269a62..7dc0b2b6 100644 --- a/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs +++ b/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs @@ -1,11 +1,7 @@ using System; -using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -namespace Octokit.Reactive.Clients +namespace Octokit.Reactive { public interface IObservableIssuesEventsClient { diff --git a/Octokit.Reactive/Clients/IObservableMilestonesClient.cs b/Octokit.Reactive/Clients/IObservableMilestonesClient.cs index 321790a1..f1ad38e3 100644 --- a/Octokit.Reactive/Clients/IObservableMilestonesClient.cs +++ b/Octokit.Reactive/Clients/IObservableMilestonesClient.cs @@ -1,9 +1,8 @@ using System; -using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Reactive; -namespace Octokit +namespace Octokit.Reactive { public interface IObservableMilestonesClient { diff --git a/Octokit.Reactive/Clients/ObservableGistCommentsClient.cs b/Octokit.Reactive/Clients/ObservableGistCommentsClient.cs index ff3afe60..e1e6f576 100644 --- a/Octokit.Reactive/Clients/ObservableGistCommentsClient.cs +++ b/Octokit.Reactive/Clients/ObservableGistCommentsClient.cs @@ -1,10 +1,9 @@ using System; using System.Reactive; using System.Reactive.Threading.Tasks; - using Octokit.Reactive.Internal; -namespace Octokit.Reactive.Clients +namespace Octokit.Reactive { public class ObservableGistCommentsClient : IObservableGistCommentsClient { @@ -27,7 +26,7 @@ namespace Octokit.Reactive.Clients /// /// The id of the gist /// The id of the comment - /// Task{GistComment}. + /// IObservable{GistComment}. public IObservable Get(int gistId, int commentId) { return _client.Get(gistId, commentId).ToObservable(); @@ -40,7 +39,7 @@ namespace Octokit.Reactive.Clients /// http://developer.github.com/v3/gists/comments/#list-comments-on-a-gist /// /// The id of the gist - /// Task{IReadOnlyList{GistComment}}. + /// IObservable{GistComment}. public IObservable GetForGist(int gistId) { return _connection.GetAndFlattenAllPages(ApiUrls.GistComments(gistId)); @@ -54,7 +53,7 @@ namespace Octokit.Reactive.Clients /// /// The id of the gist /// The body of the comment - /// Task{GistComment}. + /// IObservable{GistComment}. public IObservable Create(int gistId, string comment) { Ensure.ArgumentNotNullOrEmptyString(comment, "comment"); @@ -71,7 +70,7 @@ namespace Octokit.Reactive.Clients /// The id of the gist /// The id of the comment /// The updated body of the comment - /// Task{GistComment}. + /// IObservable{GistComment}. public IObservable Update(int gistId, int commentId, string comment) { Ensure.ArgumentNotNullOrEmptyString(comment, "comment"); @@ -87,7 +86,7 @@ namespace Octokit.Reactive.Clients /// /// The id of the gist /// The id of the comment - /// Task. + /// IObservable{Unit}. public IObservable Delete(int gistId, int commentId) { return _client.Delete(gistId, commentId).ToObservable(); diff --git a/Octokit.Reactive/Clients/ObservableGistsClient.cs b/Octokit.Reactive/Clients/ObservableGistsClient.cs index f98cb891..63c2e6b7 100644 --- a/Octokit.Reactive/Clients/ObservableGistsClient.cs +++ b/Octokit.Reactive/Clients/ObservableGistsClient.cs @@ -1,7 +1,7 @@ using System; using System.Reactive.Threading.Tasks; -namespace Octokit.Reactive.Clients +namespace Octokit.Reactive { public class ObservableGistsClient : IObservableGistsClient { @@ -17,6 +17,14 @@ namespace Octokit.Reactive.Clients public IObservableGistCommentsClient Comment { get; set; } + /// + /// Gets a gist + /// + /// + /// http://developer.github.com/v3/gists/#get-a-single-gist + /// + /// The id of the gist + /// IObservable{Gist}. public IObservable Get(string id) { Ensure.ArgumentNotNullOrEmptyString(id, "id"); diff --git a/Octokit.Reactive/Clients/ObservableIssuesClient.cs b/Octokit.Reactive/Clients/ObservableIssuesClient.cs index 38db8211..c9042400 100644 --- a/Octokit.Reactive/Clients/ObservableIssuesClient.cs +++ b/Octokit.Reactive/Clients/ObservableIssuesClient.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Reactive.Threading.Tasks; -using Octokit.Reactive.Clients; using Octokit.Reactive.Internal; namespace Octokit.Reactive diff --git a/Octokit.Reactive/Clients/ObservableIssuesEventsClient.cs b/Octokit.Reactive/Clients/ObservableIssuesEventsClient.cs index 50e54300..67ff9184 100644 --- a/Octokit.Reactive/Clients/ObservableIssuesEventsClient.cs +++ b/Octokit.Reactive/Clients/ObservableIssuesEventsClient.cs @@ -1,9 +1,8 @@ using System; -using System.Reactive; using System.Reactive.Threading.Tasks; using Octokit.Reactive.Internal; -namespace Octokit.Reactive.Clients +namespace Octokit.Reactive { public class ObservableIssuesEventsClient : IObservableIssuesEventsClient { diff --git a/Octokit.Reactive/Clients/ObservableMilestonesClient.cs b/Octokit.Reactive/Clients/ObservableMilestonesClient.cs index bd33ad53..65dcaf86 100644 --- a/Octokit.Reactive/Clients/ObservableMilestonesClient.cs +++ b/Octokit.Reactive/Clients/ObservableMilestonesClient.cs @@ -3,7 +3,7 @@ using System.Reactive; using System.Reactive.Threading.Tasks; using Octokit.Reactive.Internal; -namespace Octokit.Reactive.Clients +namespace Octokit.Reactive { public class ObservableMilestonesClient : IObservableMilestonesClient { diff --git a/Octokit.Reactive/Clients/ObservableNotificationsClient.cs b/Octokit.Reactive/Clients/ObservableNotificationsClient.cs index 40893408..f7a3889d 100644 --- a/Octokit.Reactive/Clients/ObservableNotificationsClient.cs +++ b/Octokit.Reactive/Clients/ObservableNotificationsClient.cs @@ -1,7 +1,7 @@ using System; using Octokit.Reactive.Internal; -namespace Octokit.Reactive.Clients +namespace Octokit.Reactive { public class ObservableNotificationsClient : IObservableNotificationsClient { diff --git a/Octokit.Reactive/Clients/ObservableStarredClient.cs b/Octokit.Reactive/Clients/ObservableStarredClient.cs index 040170e9..7439c111 100644 --- a/Octokit.Reactive/Clients/ObservableStarredClient.cs +++ b/Octokit.Reactive/Clients/ObservableStarredClient.cs @@ -1,9 +1,9 @@ using System; -using System.Reactive; using System.Reactive.Threading.Tasks; + using Octokit.Reactive.Internal; -namespace Octokit.Reactive.Clients +namespace Octokit.Reactive { public class ObservableStarredClient { diff --git a/Octokit.Reactive/IObservableGitHubClient.cs b/Octokit.Reactive/IObservableGitHubClient.cs index 2879c2b7..4f0cb79d 100644 --- a/Octokit.Reactive/IObservableGitHubClient.cs +++ b/Octokit.Reactive/IObservableGitHubClient.cs @@ -1,6 +1,4 @@ -using Octokit.Reactive.Clients; - -namespace Octokit.Reactive +namespace Octokit.Reactive { public interface IObservableGitHubClient { diff --git a/Octokit.Reactive/ObservableGitHubClient.cs b/Octokit.Reactive/ObservableGitHubClient.cs index edb59091..f5fad6f4 100644 --- a/Octokit.Reactive/ObservableGitHubClient.cs +++ b/Octokit.Reactive/ObservableGitHubClient.cs @@ -1,6 +1,5 @@ using System; using System.Net.Http.Headers; -using Octokit.Reactive.Clients; namespace Octokit.Reactive { diff --git a/Octokit.Reactive/Octokit.Reactive.csproj.DotSettings b/Octokit.Reactive/Octokit.Reactive.csproj.DotSettings new file mode 100644 index 00000000..a4f335fe --- /dev/null +++ b/Octokit.Reactive/Octokit.Reactive.csproj.DotSettings @@ -0,0 +1,2 @@ + + True \ No newline at end of file diff --git a/Octokit.Tests.Integration/Reactive/ObservableMilestonesClientTests.cs b/Octokit.Tests.Integration/Reactive/ObservableMilestonesClientTests.cs index ab7f232d..2eedd3b1 100644 --- a/Octokit.Tests.Integration/Reactive/ObservableMilestonesClientTests.cs +++ b/Octokit.Tests.Integration/Reactive/ObservableMilestonesClientTests.cs @@ -2,7 +2,7 @@ using System.Net.Http.Headers; using System.Reactive.Linq; using System.Threading.Tasks; -using Octokit.Reactive.Clients; +using Octokit.Reactive; using Xunit; namespace Octokit.Tests.Integration diff --git a/Octokit.Tests/Clients/GistCommentsClientTests.cs b/Octokit.Tests/Clients/GistCommentsClientTests.cs index 6d7db2a9..8ca77c6e 100644 --- a/Octokit.Tests/Clients/GistCommentsClientTests.cs +++ b/Octokit.Tests/Clients/GistCommentsClientTests.cs @@ -1,113 +1,108 @@ using System; using System.Threading.Tasks; - using NSubstitute; - +using Octokit; using Octokit.Tests.Helpers; - using Xunit; -namespace Octokit.Tests.Clients +public class GistCommentsClientTests { - public class GistCommentsClientTests + public class TheCtor { - public class TheCtor + [Fact] + public void EnsuresArgument() { - [Fact] - public void EnsuresArgument() - { - Assert.Throws(() => new GistCommentsClient(null)); - } + Assert.Throws(() => new GistCommentsClient(null)); + } + } + + public class TheGetMethod + { + [Fact] + public async Task RequestsCorrectUrl() + { + var connection = Substitute.For(); + var client = new GistCommentsClient(connection); + + await client.Get(24, 1337); + + connection.Received().Get(Arg.Is(u => u.ToString() == "gists/24/comments/1337"), null); + } + } + + public class TheGetForGistMethod + { + [Fact] + public async Task RequestsCorrectUrl() + { + var connection = Substitute.For(); + var client = new GistCommentsClient(connection); + + await client.GetForGist(24); + + connection.Received().GetAll(Arg.Is(u => u.ToString() == "gists/24/comments")); + } + } + + public class TheCreateMethod + { + [Fact] + public async Task EnsuresNonNullArguments() + { + var client = new GistCommentsClient(Substitute.For()); + + await AssertEx.Throws(async () => await client.Create(24, null)); + await AssertEx.Throws(async () => await client.Create(24, "")); } - public class TheGetMethod + [Fact] + public async Task PostsToCorrectUrl() { - [Fact] - public async Task RequestsCorrectUrl() - { - var connection = Substitute.For(); - var client = new GistCommentsClient(connection); + var comment = "This is a comment."; + var connection = Substitute.For(); + var client = new GistCommentsClient(connection); - await client.Get(24, 1337); + await client.Create(24, comment); - connection.Received().Get(Arg.Is(u => u.ToString() == "gists/24/comments/1337"), null); - } + connection.Received().Post(Arg.Is(u => u.ToString() == "gists/24/comments"), Arg.Is(x => x.Body == comment)); + } + } + + public class TheUpdateMethod + { + [Fact] + public async Task EnsuresNonNullArguments() + { + var client = new GistCommentsClient(Substitute.For()); + + await AssertEx.Throws(async () => await client.Update(24, 1337, null)); + await AssertEx.Throws(async () => await client.Update(24, 1337, "")); } - public class TheGetForGistMethod + [Fact] + public async Task PostsToCorrectUrl() { - [Fact] - public async Task RequestsCorrectUrl() - { - var connection = Substitute.For(); - var client = new GistCommentsClient(connection); + var comment = "This is a comment."; + var connection = Substitute.For(); + var client = new GistCommentsClient(connection); - await client.GetForGist(24); + await client.Update(24, 1337, comment); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "gists/24/comments")); - } + connection.Received().Patch(Arg.Is(u => u.ToString() == "gists/24/comments/1337"), Arg.Is(x => x.Body == comment)); } + } - public class TheCreateMethod + public class TheDeleteMethod + { + [Fact] + public async Task PostsToCorrectUrl() { - [Fact] - public async Task EnsuresNonNullArguments() - { - var client = new GistCommentsClient(Substitute.For()); + var connection = Substitute.For(); + var client = new GistCommentsClient(connection); - await AssertEx.Throws(async () => await client.Create(24, null)); - await AssertEx.Throws(async () => await client.Create(24, "")); - } + await client.Delete(24, 1337); - [Fact] - public async Task PostsToCorrectUrl() - { - var comment = "This is a comment."; - var connection = Substitute.For(); - var client = new GistCommentsClient(connection); - - await client.Create(24, comment); - - connection.Received().Post(Arg.Is(u => u.ToString() == "gists/24/comments"), Arg.Is(x => x.Body == comment)); - } - } - - public class TheUpdateMethod - { - [Fact] - public async Task EnsuresNonNullArguments() - { - var client = new GistCommentsClient(Substitute.For()); - - await AssertEx.Throws(async () => await client.Update(24, 1337, null)); - await AssertEx.Throws(async () => await client.Update(24, 1337, "")); - } - - [Fact] - public async Task PostsToCorrectUrl() - { - var comment = "This is a comment."; - var connection = Substitute.For(); - var client = new GistCommentsClient(connection); - - await client.Update(24, 1337, comment); - - connection.Received().Patch(Arg.Is(u => u.ToString() == "gists/24/comments/1337"), Arg.Is(x => x.Body == comment)); - } - } - - public class TheDeleteMethod - { - [Fact] - public async Task PostsToCorrectUrl() - { - var connection = Substitute.For(); - var client = new GistCommentsClient(connection); - - await client.Delete(24, 1337); - - connection.Received().Delete(Arg.Is(u => u.ToString() == "gists/24/comments/1337")); - } + connection.Received().Delete(Arg.Is(u => u.ToString() == "gists/24/comments/1337")); } } } \ No newline at end of file diff --git a/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs b/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs index d0216d85..35b1666d 100644 --- a/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using NSubstitute; using Octokit; using Octokit.Internal; -using Octokit.Reactive.Clients; +using Octokit.Reactive; using Octokit.Tests.Helpers; using Xunit; diff --git a/Octokit.Tests/Reactive/ObservableStarredClientTests.cs b/Octokit.Tests/Reactive/ObservableStarredClientTests.cs index 6b1c7dfd..f8797c2f 100644 --- a/Octokit.Tests/Reactive/ObservableStarredClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableStarredClientTests.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using NSubstitute; using Octokit; using Octokit.Internal; -using Octokit.Reactive.Clients; +using Octokit.Reactive; using Octokit.Reactive.Internal; using Octokit.Tests.Helpers; using Xunit;