mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-20 14:15:12 +00:00
Fixed minor namespace and whitespace issues
This commit is contained in:
@@ -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
|
||||
/// <remarks>http://developer.github.com/v3/gists/comments/#get-a-single-comment</remarks>
|
||||
/// <param name="gistId">The id of the gist</param>
|
||||
/// <param name="commentId">The id of the comment</param>
|
||||
/// <returns>Task{GistComment}.</returns>
|
||||
/// <returns>IObservable{GistComment}.</returns>
|
||||
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
|
||||
Justification = "Method makes a network request")]
|
||||
IObservable<GistComment> Get(int gistId, int commentId);
|
||||
@@ -22,7 +22,7 @@ namespace Octokit.Reactive.Clients
|
||||
/// </summary>
|
||||
/// <remarks>http://developer.github.com/v3/gists/comments/#list-comments-on-a-gist</remarks>
|
||||
/// <param name="gistId">The id of the gist</param>
|
||||
/// <returns>Task{IReadOnlyList{GistComment}}.</returns>
|
||||
/// <returns>IObservable{GistComment}.</returns>
|
||||
IObservable<GistComment> GetForGist(int gistId);
|
||||
|
||||
/// <summary>
|
||||
@@ -31,7 +31,7 @@ namespace Octokit.Reactive.Clients
|
||||
/// <remarks>http://developer.github.com/v3/gists/comments/#create-a-comment</remarks>
|
||||
/// <param name="gistId">The id of the gist</param>
|
||||
/// <param name="comment">The body of the comment</param>
|
||||
/// <returns>Task{GistComment}.</returns>
|
||||
/// <returns>IObservable{GistComment}.</returns>
|
||||
IObservable<GistComment> Create(int gistId, string comment);
|
||||
|
||||
/// <summary>
|
||||
@@ -41,7 +41,7 @@ namespace Octokit.Reactive.Clients
|
||||
/// <param name="gistId">The id of the gist</param>
|
||||
/// <param name="commentId">The id of the comment</param>
|
||||
/// <param name="comment">The updated body of the comment</param>
|
||||
/// <returns>Task{GistComment}.</returns>
|
||||
/// <returns>IObservable{GistComment}.</returns>
|
||||
IObservable<GistComment> Update(int gistId, int commentId, string comment);
|
||||
|
||||
/// <summary>
|
||||
@@ -50,7 +50,7 @@ namespace Octokit.Reactive.Clients
|
||||
/// <remarks>http://developer.github.com/v3/gists/comments/#delete-a-comment</remarks>
|
||||
/// <param name="gistId">The id of the gist</param>
|
||||
/// <param name="commentId">The id of the comment</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <returns>IObservable{Unit}.</returns>
|
||||
IObservable<Unit> Delete(int gistId, int commentId);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Octokit.Reactive.Clients
|
||||
namespace Octokit.Reactive
|
||||
{
|
||||
public interface IObservableGistsClient
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
/// </remarks>
|
||||
/// <param name="gistId">The id of the gist</param>
|
||||
/// <param name="commentId">The id of the comment</param>
|
||||
/// <returns>Task{GistComment}.</returns>
|
||||
/// <returns>IObservable{GistComment}.</returns>
|
||||
public IObservable<GistComment> 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
|
||||
/// </remarks>
|
||||
/// <param name="gistId">The id of the gist</param>
|
||||
/// <returns>Task{IReadOnlyList{GistComment}}.</returns>
|
||||
/// <returns>IObservable{GistComment}.</returns>
|
||||
public IObservable<GistComment> GetForGist(int gistId)
|
||||
{
|
||||
return _connection.GetAndFlattenAllPages<GistComment>(ApiUrls.GistComments(gistId));
|
||||
@@ -54,7 +53,7 @@ namespace Octokit.Reactive.Clients
|
||||
/// </remarks>
|
||||
/// <param name="gistId">The id of the gist</param>
|
||||
/// <param name="comment">The body of the comment</param>
|
||||
/// <returns>Task{GistComment}.</returns>
|
||||
/// <returns>IObservable{GistComment}.</returns>
|
||||
public IObservable<GistComment> Create(int gistId, string comment)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(comment, "comment");
|
||||
@@ -71,7 +70,7 @@ namespace Octokit.Reactive.Clients
|
||||
/// <param name="gistId">The id of the gist</param>
|
||||
/// <param name="commentId">The id of the comment</param>
|
||||
/// <param name="comment">The updated body of the comment</param>
|
||||
/// <returns>Task{GistComment}.</returns>
|
||||
/// <returns>IObservable{GistComment}.</returns>
|
||||
public IObservable<GistComment> Update(int gistId, int commentId, string comment)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(comment, "comment");
|
||||
@@ -87,7 +86,7 @@ namespace Octokit.Reactive.Clients
|
||||
/// </remarks>
|
||||
/// <param name="gistId">The id of the gist</param>
|
||||
/// <param name="commentId">The id of the comment</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <returns>IObservable{Unit}.</returns>
|
||||
public IObservable<Unit> Delete(int gistId, int commentId)
|
||||
{
|
||||
return _client.Delete(gistId, commentId).ToObservable();
|
||||
|
||||
@@ -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; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a gist
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// http://developer.github.com/v3/gists/#get-a-single-gist
|
||||
/// </remarks>
|
||||
/// <param name="id">The id of the gist</param>
|
||||
/// <returns>IObservable{Gist}.</returns>
|
||||
public IObservable<Gist> Get(string id)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(id, "id");
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using Octokit.Reactive.Internal;
|
||||
|
||||
namespace Octokit.Reactive.Clients
|
||||
namespace Octokit.Reactive
|
||||
{
|
||||
public class ObservableNotificationsClient : IObservableNotificationsClient
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Octokit.Reactive.Clients;
|
||||
|
||||
namespace Octokit.Reactive
|
||||
namespace Octokit.Reactive
|
||||
{
|
||||
public interface IObservableGitHubClient
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Net.Http.Headers;
|
||||
using Octokit.Reactive.Clients;
|
||||
|
||||
namespace Octokit.Reactive
|
||||
{
|
||||
|
||||
2
Octokit.Reactive/Octokit.Reactive.csproj.DotSettings
Normal file
2
Octokit.Reactive/Octokit.Reactive.csproj.DotSettings
Normal file
@@ -0,0 +1,2 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=Clients/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
@@ -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
|
||||
|
||||
@@ -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<ArgumentNullException>(() => new GistCommentsClient(null));
|
||||
}
|
||||
Assert.Throws<ArgumentNullException>(() => new GistCommentsClient(null));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheGetMethod
|
||||
{
|
||||
[Fact]
|
||||
public async Task RequestsCorrectUrl()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new GistCommentsClient(connection);
|
||||
|
||||
await client.Get(24, 1337);
|
||||
|
||||
connection.Received().Get<GistComment>(Arg.Is<Uri>(u => u.ToString() == "gists/24/comments/1337"), null);
|
||||
}
|
||||
}
|
||||
|
||||
public class TheGetForGistMethod
|
||||
{
|
||||
[Fact]
|
||||
public async Task RequestsCorrectUrl()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new GistCommentsClient(connection);
|
||||
|
||||
await client.GetForGist(24);
|
||||
|
||||
connection.Received().GetAll<GistComment>(Arg.Is<Uri>(u => u.ToString() == "gists/24/comments"));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheCreateMethod
|
||||
{
|
||||
[Fact]
|
||||
public async Task EnsuresNonNullArguments()
|
||||
{
|
||||
var client = new GistCommentsClient(Substitute.For<IApiConnection>());
|
||||
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Create(24, null));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.Create(24, ""));
|
||||
}
|
||||
|
||||
public class TheGetMethod
|
||||
[Fact]
|
||||
public async Task PostsToCorrectUrl()
|
||||
{
|
||||
[Fact]
|
||||
public async Task RequestsCorrectUrl()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new GistCommentsClient(connection);
|
||||
var comment = "This is a comment.";
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new GistCommentsClient(connection);
|
||||
|
||||
await client.Get(24, 1337);
|
||||
await client.Create(24, comment);
|
||||
|
||||
connection.Received().Get<GistComment>(Arg.Is<Uri>(u => u.ToString() == "gists/24/comments/1337"), null);
|
||||
}
|
||||
connection.Received().Post<GistComment>(Arg.Is<Uri>(u => u.ToString() == "gists/24/comments"), Arg.Is<BodyWrapper>(x => x.Body == comment));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheUpdateMethod
|
||||
{
|
||||
[Fact]
|
||||
public async Task EnsuresNonNullArguments()
|
||||
{
|
||||
var client = new GistCommentsClient(Substitute.For<IApiConnection>());
|
||||
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Update(24, 1337, null));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.Update(24, 1337, ""));
|
||||
}
|
||||
|
||||
public class TheGetForGistMethod
|
||||
[Fact]
|
||||
public async Task PostsToCorrectUrl()
|
||||
{
|
||||
[Fact]
|
||||
public async Task RequestsCorrectUrl()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new GistCommentsClient(connection);
|
||||
var comment = "This is a comment.";
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new GistCommentsClient(connection);
|
||||
|
||||
await client.GetForGist(24);
|
||||
await client.Update(24, 1337, comment);
|
||||
|
||||
connection.Received().GetAll<GistComment>(Arg.Is<Uri>(u => u.ToString() == "gists/24/comments"));
|
||||
}
|
||||
connection.Received().Patch<GistComment>(Arg.Is<Uri>(u => u.ToString() == "gists/24/comments/1337"), Arg.Is<BodyWrapper>(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<IApiConnection>());
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new GistCommentsClient(connection);
|
||||
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Create(24, null));
|
||||
await AssertEx.Throws<ArgumentException>(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<IApiConnection>();
|
||||
var client = new GistCommentsClient(connection);
|
||||
|
||||
await client.Create(24, comment);
|
||||
|
||||
connection.Received().Post<GistComment>(Arg.Is<Uri>(u => u.ToString() == "gists/24/comments"), Arg.Is<BodyWrapper>(x => x.Body == comment));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheUpdateMethod
|
||||
{
|
||||
[Fact]
|
||||
public async Task EnsuresNonNullArguments()
|
||||
{
|
||||
var client = new GistCommentsClient(Substitute.For<IApiConnection>());
|
||||
|
||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Update(24, 1337, null));
|
||||
await AssertEx.Throws<ArgumentException>(async () => await client.Update(24, 1337, ""));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task PostsToCorrectUrl()
|
||||
{
|
||||
var comment = "This is a comment.";
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new GistCommentsClient(connection);
|
||||
|
||||
await client.Update(24, 1337, comment);
|
||||
|
||||
connection.Received().Patch<GistComment>(Arg.Is<Uri>(u => u.ToString() == "gists/24/comments/1337"), Arg.Is<BodyWrapper>(x => x.Body == comment));
|
||||
}
|
||||
}
|
||||
|
||||
public class TheDeleteMethod
|
||||
{
|
||||
[Fact]
|
||||
public async Task PostsToCorrectUrl()
|
||||
{
|
||||
var connection = Substitute.For<IApiConnection>();
|
||||
var client = new GistCommentsClient(connection);
|
||||
|
||||
await client.Delete(24, 1337);
|
||||
|
||||
connection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "gists/24/comments/1337"));
|
||||
}
|
||||
connection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "gists/24/comments/1337"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user