mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-06 07:16:09 +00:00
bugfix - PUT should have a payload for Mark as Read (#1579)
* bugfix - PUT should have a payload for Mark as Read * also fix the Observable client test * add integration tests for MarkRead methods * Fixup MarkReadForRepository methods to specify a body in the PUT request * Fix unit tests for regular and observable client * helps if the new files are included in the test project :)
This commit is contained in:
committed by
Ryan Gribble
parent
596e51d5b3
commit
f6154dac9f
@@ -0,0 +1,41 @@
|
||||
using System.Threading.Tasks;
|
||||
using Octokit.Tests.Integration;
|
||||
using Xunit;
|
||||
|
||||
public class NotificationsClientTests
|
||||
{
|
||||
public class TheMarkAsReadMethod
|
||||
{
|
||||
[IntegrationTest]
|
||||
public async Task MarksNotificationsRead()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
await github.Activity.Notifications.MarkAsRead();
|
||||
}
|
||||
}
|
||||
|
||||
public class TheMarkAsReadForRepositoryMethod
|
||||
{
|
||||
[IntegrationTest]
|
||||
public async Task MarksNotificationsRead()
|
||||
{
|
||||
var owner = "octokit";
|
||||
var repo = "octokit.net";
|
||||
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
await github.Activity.Notifications.MarkAsReadForRepository(owner, repo);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task MarksNotificationsReadForRepositoryId()
|
||||
{
|
||||
var repositoryId = 7528679;
|
||||
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
await github.Activity.Notifications.MarkAsReadForRepository(repositoryId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,6 +98,7 @@
|
||||
<Compile Include="Clients\IssuesEventsClientTests.cs" />
|
||||
<Compile Include="Clients\MigrationsClientTests.cs" />
|
||||
<Compile Include="Clients\MilestonesClientTests.cs" />
|
||||
<Compile Include="Clients\NotificationsClientTests.cs" />
|
||||
<Compile Include="Clients\OrganizationClientTests.cs" />
|
||||
<Compile Include="Clients\OrganizationMembersClientTests.cs" />
|
||||
<Compile Include="Clients\PullRequestReviewCommentReactionsClientTests.cs" />
|
||||
@@ -157,6 +158,7 @@
|
||||
<Compile Include="Reactive\ObservableFollowersClientTests.cs" />
|
||||
<Compile Include="Reactive\ObservableGistClientTests.cs" />
|
||||
<Compile Include="Reactive\ObservableIssueTimelineClientTests.cs" />
|
||||
<Compile Include="Reactive\ObservableNotificationsClientTests.cs" />
|
||||
<Compile Include="Reactive\ObservableRepositoryDeployKeysClientTests.cs" />
|
||||
<Compile Include="Reactive\ObservableAssigneesClientTests.cs" />
|
||||
<Compile Include="Reactive\ObservableAuthorizationsClientTests.cs" />
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
using System.Reactive.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit.Reactive;
|
||||
using Octokit.Tests.Integration;
|
||||
using Xunit;
|
||||
|
||||
public class ObservableNotificationsClientTests
|
||||
{
|
||||
public class TheMarkAsReadMethod
|
||||
{
|
||||
[IntegrationTest]
|
||||
public async Task MarksNotificationsRead()
|
||||
{
|
||||
var client = new ObservableGitHubClient(Helper.GetAuthenticatedClient());
|
||||
|
||||
await client.Activity.Notifications.MarkAsRead();
|
||||
}
|
||||
}
|
||||
|
||||
public class TheMarkAsReadForRepositoryMethod
|
||||
{
|
||||
[IntegrationTest]
|
||||
public async Task MarksNotificationsRead()
|
||||
{
|
||||
var owner = "octokit";
|
||||
var repo = "octokit.net";
|
||||
|
||||
var client = new ObservableGitHubClient(Helper.GetAuthenticatedClient());
|
||||
|
||||
await client.Activity.Notifications.MarkAsReadForRepository(owner, repo);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task MarksNotificationsReadForRepositoryId()
|
||||
{
|
||||
var repositoryId = 7528679;
|
||||
|
||||
var client = new ObservableGitHubClient(Helper.GetAuthenticatedClient());
|
||||
|
||||
await client.Activity.Notifications.MarkAsReadForRepository(repositoryId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -284,7 +284,7 @@ namespace Octokit.Tests.Clients
|
||||
|
||||
client.MarkAsRead();
|
||||
|
||||
connection.Received().Put(endpoint);
|
||||
connection.Received().Put<object>(endpoint, Args.Object);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace Octokit.Tests.Clients
|
||||
|
||||
client.MarkAsReadForRepository("banana", "split");
|
||||
|
||||
connection.Received().Put(endpoint);
|
||||
connection.Received().Put<object>(endpoint, Args.Object);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -311,7 +311,7 @@ namespace Octokit.Tests.Clients
|
||||
|
||||
client.MarkAsReadForRepository(1);
|
||||
|
||||
connection.Received().Put(endpoint);
|
||||
connection.Received().Put<object>(endpoint, Args.Object);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -302,7 +302,7 @@ namespace Octokit.Tests.Reactive
|
||||
|
||||
client.MarkAsRead();
|
||||
|
||||
connection.Received().Put(endpoint);
|
||||
connection.Received().Put<object>(endpoint, Args.Object);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ namespace Octokit.Tests.Reactive
|
||||
|
||||
client.MarkAsReadForRepository("banana", "split");
|
||||
|
||||
connection.Received().Put(endpoint);
|
||||
connection.Received().Put<object>(endpoint, Args.Object);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -331,7 +331,7 @@ namespace Octokit.Tests.Reactive
|
||||
|
||||
client.MarkAsReadForRepository(1);
|
||||
|
||||
connection.Received().Put(endpoint);
|
||||
connection.Received().Put<object>(endpoint, Args.Object);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace Octokit
|
||||
/// <remarks>http://developer.github.com/v3/activity/notifications/#mark-as-read</remarks>
|
||||
public Task MarkAsRead()
|
||||
{
|
||||
return ApiConnection.Put(ApiUrls.Notifications());
|
||||
return ApiConnection.Put<object>(ApiUrls.Notifications(), new object());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -213,7 +213,7 @@ namespace Octokit
|
||||
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||
|
||||
return ApiConnection.Put(ApiUrls.Notifications(owner, name));
|
||||
return ApiConnection.Put<object>(ApiUrls.Notifications(owner, name), new object());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -223,7 +223,7 @@ namespace Octokit
|
||||
/// <remarks>http://developer.github.com/v3/activity/notifications/#mark-notifications-as-read-in-a-repository</remarks>
|
||||
public Task MarkAsReadForRepository(long repositoryId)
|
||||
{
|
||||
return ApiConnection.Put(ApiUrls.Notifications(repositoryId));
|
||||
return ApiConnection.Put<object>(ApiUrls.Notifications(repositoryId), new object());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user