mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-20 06:05:12 +00:00
Fixed minor namespace and whitespace issues
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Reactive;
|
using System.Reactive;
|
||||||
|
|
||||||
namespace Octokit.Reactive.Clients
|
namespace Octokit.Reactive
|
||||||
{
|
{
|
||||||
public interface IObservableGistCommentsClient
|
public interface IObservableGistCommentsClient
|
||||||
{
|
{
|
||||||
@@ -12,7 +12,7 @@ namespace Octokit.Reactive.Clients
|
|||||||
/// <remarks>http://developer.github.com/v3/gists/comments/#get-a-single-comment</remarks>
|
/// <remarks>http://developer.github.com/v3/gists/comments/#get-a-single-comment</remarks>
|
||||||
/// <param name="gistId">The id of the gist</param>
|
/// <param name="gistId">The id of the gist</param>
|
||||||
/// <param name="commentId">The id of the comment</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",
|
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
|
||||||
Justification = "Method makes a network request")]
|
Justification = "Method makes a network request")]
|
||||||
IObservable<GistComment> Get(int gistId, int commentId);
|
IObservable<GistComment> Get(int gistId, int commentId);
|
||||||
@@ -22,7 +22,7 @@ namespace Octokit.Reactive.Clients
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>http://developer.github.com/v3/gists/comments/#list-comments-on-a-gist</remarks>
|
/// <remarks>http://developer.github.com/v3/gists/comments/#list-comments-on-a-gist</remarks>
|
||||||
/// <param name="gistId">The id of the gist</param>
|
/// <param name="gistId">The id of the gist</param>
|
||||||
/// <returns>Task{IReadOnlyList{GistComment}}.</returns>
|
/// <returns>IObservable{GistComment}.</returns>
|
||||||
IObservable<GistComment> GetForGist(int gistId);
|
IObservable<GistComment> GetForGist(int gistId);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -31,7 +31,7 @@ namespace Octokit.Reactive.Clients
|
|||||||
/// <remarks>http://developer.github.com/v3/gists/comments/#create-a-comment</remarks>
|
/// <remarks>http://developer.github.com/v3/gists/comments/#create-a-comment</remarks>
|
||||||
/// <param name="gistId">The id of the gist</param>
|
/// <param name="gistId">The id of the gist</param>
|
||||||
/// <param name="comment">The body of the comment</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);
|
IObservable<GistComment> Create(int gistId, string comment);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -41,7 +41,7 @@ namespace Octokit.Reactive.Clients
|
|||||||
/// <param name="gistId">The id of the gist</param>
|
/// <param name="gistId">The id of the gist</param>
|
||||||
/// <param name="commentId">The id of the comment</param>
|
/// <param name="commentId">The id of the comment</param>
|
||||||
/// <param name="comment">The updated body 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);
|
IObservable<GistComment> Update(int gistId, int commentId, string comment);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -50,7 +50,7 @@ namespace Octokit.Reactive.Clients
|
|||||||
/// <remarks>http://developer.github.com/v3/gists/comments/#delete-a-comment</remarks>
|
/// <remarks>http://developer.github.com/v3/gists/comments/#delete-a-comment</remarks>
|
||||||
/// <param name="gistId">The id of the gist</param>
|
/// <param name="gistId">The id of the gist</param>
|
||||||
/// <param name="commentId">The id of the comment</param>
|
/// <param name="commentId">The id of the comment</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>IObservable{Unit}.</returns>
|
||||||
IObservable<Unit> Delete(int gistId, int commentId);
|
IObservable<Unit> Delete(int gistId, int commentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
namespace Octokit.Reactive.Clients
|
namespace Octokit.Reactive
|
||||||
{
|
{
|
||||||
public interface IObservableGistsClient
|
public interface IObservableGistsClient
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Octokit.Reactive.Clients
|
namespace Octokit.Reactive
|
||||||
{
|
{
|
||||||
public interface IObservableIssuesEventsClient
|
public interface IObservableIssuesEventsClient
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Reactive;
|
using System.Reactive;
|
||||||
|
|
||||||
namespace Octokit
|
namespace Octokit.Reactive
|
||||||
{
|
{
|
||||||
public interface IObservableMilestonesClient
|
public interface IObservableMilestonesClient
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reactive;
|
using System.Reactive;
|
||||||
using System.Reactive.Threading.Tasks;
|
using System.Reactive.Threading.Tasks;
|
||||||
|
|
||||||
using Octokit.Reactive.Internal;
|
using Octokit.Reactive.Internal;
|
||||||
|
|
||||||
namespace Octokit.Reactive.Clients
|
namespace Octokit.Reactive
|
||||||
{
|
{
|
||||||
public class ObservableGistCommentsClient : IObservableGistCommentsClient
|
public class ObservableGistCommentsClient : IObservableGistCommentsClient
|
||||||
{
|
{
|
||||||
@@ -27,7 +26,7 @@ namespace Octokit.Reactive.Clients
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="gistId">The id of the gist</param>
|
/// <param name="gistId">The id of the gist</param>
|
||||||
/// <param name="commentId">The id of the comment</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)
|
public IObservable<GistComment> Get(int gistId, int commentId)
|
||||||
{
|
{
|
||||||
return _client.Get(gistId, commentId).ToObservable();
|
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
|
/// http://developer.github.com/v3/gists/comments/#list-comments-on-a-gist
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="gistId">The id of the gist</param>
|
/// <param name="gistId">The id of the gist</param>
|
||||||
/// <returns>Task{IReadOnlyList{GistComment}}.</returns>
|
/// <returns>IObservable{GistComment}.</returns>
|
||||||
public IObservable<GistComment> GetForGist(int gistId)
|
public IObservable<GistComment> GetForGist(int gistId)
|
||||||
{
|
{
|
||||||
return _connection.GetAndFlattenAllPages<GistComment>(ApiUrls.GistComments(gistId));
|
return _connection.GetAndFlattenAllPages<GistComment>(ApiUrls.GistComments(gistId));
|
||||||
@@ -54,7 +53,7 @@ namespace Octokit.Reactive.Clients
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="gistId">The id of the gist</param>
|
/// <param name="gistId">The id of the gist</param>
|
||||||
/// <param name="comment">The body of the comment</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)
|
public IObservable<GistComment> Create(int gistId, string comment)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNullOrEmptyString(comment, "comment");
|
Ensure.ArgumentNotNullOrEmptyString(comment, "comment");
|
||||||
@@ -71,7 +70,7 @@ namespace Octokit.Reactive.Clients
|
|||||||
/// <param name="gistId">The id of the gist</param>
|
/// <param name="gistId">The id of the gist</param>
|
||||||
/// <param name="commentId">The id of the comment</param>
|
/// <param name="commentId">The id of the comment</param>
|
||||||
/// <param name="comment">The updated body 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)
|
public IObservable<GistComment> Update(int gistId, int commentId, string comment)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNullOrEmptyString(comment, "comment");
|
Ensure.ArgumentNotNullOrEmptyString(comment, "comment");
|
||||||
@@ -87,7 +86,7 @@ namespace Octokit.Reactive.Clients
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="gistId">The id of the gist</param>
|
/// <param name="gistId">The id of the gist</param>
|
||||||
/// <param name="commentId">The id of the comment</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)
|
public IObservable<Unit> Delete(int gistId, int commentId)
|
||||||
{
|
{
|
||||||
return _client.Delete(gistId, commentId).ToObservable();
|
return _client.Delete(gistId, commentId).ToObservable();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reactive.Threading.Tasks;
|
using System.Reactive.Threading.Tasks;
|
||||||
|
|
||||||
namespace Octokit.Reactive.Clients
|
namespace Octokit.Reactive
|
||||||
{
|
{
|
||||||
public class ObservableGistsClient : IObservableGistsClient
|
public class ObservableGistsClient : IObservableGistsClient
|
||||||
{
|
{
|
||||||
@@ -17,6 +17,14 @@ namespace Octokit.Reactive.Clients
|
|||||||
|
|
||||||
public IObservableGistCommentsClient Comment { get; set; }
|
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)
|
public IObservable<Gist> Get(string id)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNullOrEmptyString(id, "id");
|
Ensure.ArgumentNotNullOrEmptyString(id, "id");
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Reactive.Threading.Tasks;
|
using System.Reactive.Threading.Tasks;
|
||||||
using Octokit.Reactive.Clients;
|
|
||||||
using Octokit.Reactive.Internal;
|
using Octokit.Reactive.Internal;
|
||||||
|
|
||||||
namespace Octokit.Reactive
|
namespace Octokit.Reactive
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reactive;
|
|
||||||
using System.Reactive.Threading.Tasks;
|
using System.Reactive.Threading.Tasks;
|
||||||
using Octokit.Reactive.Internal;
|
using Octokit.Reactive.Internal;
|
||||||
|
|
||||||
namespace Octokit.Reactive.Clients
|
namespace Octokit.Reactive
|
||||||
{
|
{
|
||||||
public class ObservableIssuesEventsClient : IObservableIssuesEventsClient
|
public class ObservableIssuesEventsClient : IObservableIssuesEventsClient
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using System.Reactive;
|
|||||||
using System.Reactive.Threading.Tasks;
|
using System.Reactive.Threading.Tasks;
|
||||||
using Octokit.Reactive.Internal;
|
using Octokit.Reactive.Internal;
|
||||||
|
|
||||||
namespace Octokit.Reactive.Clients
|
namespace Octokit.Reactive
|
||||||
{
|
{
|
||||||
public class ObservableMilestonesClient : IObservableMilestonesClient
|
public class ObservableMilestonesClient : IObservableMilestonesClient
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using Octokit.Reactive.Internal;
|
using Octokit.Reactive.Internal;
|
||||||
|
|
||||||
namespace Octokit.Reactive.Clients
|
namespace Octokit.Reactive
|
||||||
{
|
{
|
||||||
public class ObservableNotificationsClient : IObservableNotificationsClient
|
public class ObservableNotificationsClient : IObservableNotificationsClient
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reactive;
|
|
||||||
using System.Reactive.Threading.Tasks;
|
using System.Reactive.Threading.Tasks;
|
||||||
|
|
||||||
using Octokit.Reactive.Internal;
|
using Octokit.Reactive.Internal;
|
||||||
|
|
||||||
namespace Octokit.Reactive.Clients
|
namespace Octokit.Reactive
|
||||||
{
|
{
|
||||||
public class ObservableStarredClient
|
public class ObservableStarredClient
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
using Octokit.Reactive.Clients;
|
namespace Octokit.Reactive
|
||||||
|
|
||||||
namespace Octokit.Reactive
|
|
||||||
{
|
{
|
||||||
public interface IObservableGitHubClient
|
public interface IObservableGitHubClient
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using Octokit.Reactive.Clients;
|
|
||||||
|
|
||||||
namespace Octokit.Reactive
|
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.Net.Http.Headers;
|
||||||
using System.Reactive.Linq;
|
using System.Reactive.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Octokit.Reactive.Clients;
|
using Octokit.Reactive;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Octokit.Tests.Integration
|
namespace Octokit.Tests.Integration
|
||||||
|
|||||||
@@ -1,113 +1,108 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using NSubstitute;
|
using NSubstitute;
|
||||||
|
using Octokit;
|
||||||
using Octokit.Tests.Helpers;
|
using Octokit.Tests.Helpers;
|
||||||
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Octokit.Tests.Clients
|
public class GistCommentsClientTests
|
||||||
{
|
{
|
||||||
public class GistCommentsClientTests
|
public class TheCtor
|
||||||
{
|
{
|
||||||
public class TheCtor
|
[Fact]
|
||||||
|
public void EnsuresArgument()
|
||||||
{
|
{
|
||||||
[Fact]
|
Assert.Throws<ArgumentNullException>(() => new GistCommentsClient(null));
|
||||||
public void EnsuresArgument()
|
}
|
||||||
{
|
}
|
||||||
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]
|
var comment = "This is a comment.";
|
||||||
public async Task RequestsCorrectUrl()
|
var connection = Substitute.For<IApiConnection>();
|
||||||
{
|
var client = new GistCommentsClient(connection);
|
||||||
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]
|
var comment = "This is a comment.";
|
||||||
public async Task RequestsCorrectUrl()
|
var connection = Substitute.For<IApiConnection>();
|
||||||
{
|
var client = new GistCommentsClient(connection);
|
||||||
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]
|
var connection = Substitute.For<IApiConnection>();
|
||||||
public async Task EnsuresNonNullArguments()
|
var client = new GistCommentsClient(connection);
|
||||||
{
|
|
||||||
var client = new GistCommentsClient(Substitute.For<IApiConnection>());
|
|
||||||
|
|
||||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Create(24, null));
|
await client.Delete(24, 1337);
|
||||||
await AssertEx.Throws<ArgumentException>(async () => await client.Create(24, ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
connection.Received().Delete(Arg.Is<Uri>(u => u.ToString() == "gists/24/comments/1337"));
|
||||||
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"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
|||||||
using NSubstitute;
|
using NSubstitute;
|
||||||
using Octokit;
|
using Octokit;
|
||||||
using Octokit.Internal;
|
using Octokit.Internal;
|
||||||
using Octokit.Reactive.Clients;
|
using Octokit.Reactive;
|
||||||
using Octokit.Tests.Helpers;
|
using Octokit.Tests.Helpers;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
|||||||
using NSubstitute;
|
using NSubstitute;
|
||||||
using Octokit;
|
using Octokit;
|
||||||
using Octokit.Internal;
|
using Octokit.Internal;
|
||||||
using Octokit.Reactive.Clients;
|
using Octokit.Reactive;
|
||||||
using Octokit.Reactive.Internal;
|
using Octokit.Reactive.Internal;
|
||||||
using Octokit.Tests.Helpers;
|
using Octokit.Tests.Helpers;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|||||||
Reference in New Issue
Block a user