diff --git a/Octokit.Reactive/Clients/IObservableEventsClient.cs b/Octokit.Reactive/Clients/IObservableEventsClient.cs
index 803a23fc21..1a30e855a3 100644
--- a/Octokit.Reactive/Clients/IObservableEventsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableEventsClient.cs
@@ -2,6 +2,12 @@
namespace Octokit.Reactive
{
+ ///
+ /// A client for GitHub's Activity Events API.
+ ///
+ ///
+ /// See the Activity Events API documentation for more information
+ ///
public interface IObservableEventsClient
{
///
@@ -10,7 +16,6 @@ public interface IObservableEventsClient
///
/// http://developer.github.com/v3/activity/events/#list-public-events
///
- /// All the public s for the particular user.
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
IObservable GetAll();
@@ -21,7 +26,6 @@ public interface IObservableEventsClient
/// http://developer.github.com/v3/activity/events/#list-public-events
///
/// Options for changing the API response
- /// All the public s for the particular user.
IObservable GetAll(ApiOptions options);
///
@@ -32,9 +36,17 @@ public interface IObservableEventsClient
///
/// The owner of the repository
/// The name of the repository
- /// All the s for the particular repository.
IObservable GetAllForRepository(string owner, string name);
+ ///
+ /// Gets all the events for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ ///
+ /// The ID of the repository
+ IObservable GetAllForRepository(int repositoryId);
+
///
/// Gets all the events for a given repository
///
@@ -44,9 +56,18 @@ public interface IObservableEventsClient
/// The owner of the repository
/// The name of the repository
/// Options for changing the API response
- /// All the s for the particular repository.
IObservable GetAllForRepository(string owner, string name, ApiOptions options);
+ ///
+ /// Gets all the events for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ ///
+ /// The ID of the repository
+ /// Options for changing the API response
+ IObservable GetAllForRepository(int repositoryId, ApiOptions options);
+
///
/// Gets all the issue events for a given repository
///
@@ -55,9 +76,17 @@ public interface IObservableEventsClient
///
/// The owner of the repository
/// The name of the repository
- /// All the s for the particular repository.
IObservable GetAllIssuesForRepository(string owner, string name);
+ ///
+ /// Gets all the issue events for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ ///
+ /// The ID of the repository
+ IObservable GetAllIssuesForRepository(int repositoryId);
+
///
/// Gets all the issue events for a given repository
///
@@ -67,9 +96,18 @@ public interface IObservableEventsClient
/// The owner of the repository
/// The name of the repository
/// Options for changing the API response
- /// All the s for the particular repository.
IObservable GetAllIssuesForRepository(string owner, string name, ApiOptions options);
+ ///
+ /// Gets all the issue events for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ ///
+ /// The ID of the repository
+ /// Options for changing the API response
+ IObservable GetAllIssuesForRepository(int repositoryId, ApiOptions options);
+
///
/// Gets all the events for a given repository network
///
@@ -78,7 +116,6 @@ public interface IObservableEventsClient
///
/// The owner of the repository
/// The name of the repository
- /// All the s for the particular repository network.
IObservable GetAllForRepositoryNetwork(string owner, string name);
///
@@ -90,7 +127,6 @@ public interface IObservableEventsClient
/// The owner of the repository
/// The name of the repository
/// Options for changing the API response
- /// All the s for the particular repository network.
IObservable GetAllForRepositoryNetwork(string owner, string name, ApiOptions options);
///
@@ -100,7 +136,6 @@ public interface IObservableEventsClient
/// http://developer.github.com/v3/activity/events/#list-public-events-for-an-organization
///
/// The name of the organization
- /// All the s for the particular organization.
IObservable GetAllForOrganization(string organization);
///
@@ -111,7 +146,6 @@ public interface IObservableEventsClient
///
/// The name of the organization
/// Options for changing the API response
- /// All the s for the particular organization.
IObservable GetAllForOrganization(string organization, ApiOptions options);
///
@@ -121,7 +155,6 @@ public interface IObservableEventsClient
/// http://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
///
/// The login of the user
- /// All the s that a particular user has received.
IObservable GetAllUserReceived(string user);
///
@@ -132,7 +165,6 @@ public interface IObservableEventsClient
///
/// The login of the user
/// Options for changing the API response
- /// All the s that a particular user has received.
IObservable GetAllUserReceived(string user, ApiOptions options);
///
@@ -142,7 +174,6 @@ public interface IObservableEventsClient
/// http://developer.github.com/v3/activity/events/#list-public-events-that-a-user-has-received
///
/// The login of the user
- /// All the s that a particular user has received.
IObservable GetAllUserReceivedPublic(string user);
///
@@ -153,7 +184,6 @@ public interface IObservableEventsClient
///
/// The login of the user
/// Options for changing the API response
- /// All the s that a particular user has received.
IObservable GetAllUserReceivedPublic(string user, ApiOptions options);
///
@@ -163,7 +193,6 @@ public interface IObservableEventsClient
/// http://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
///
/// The login of the user
- /// All the s that a particular user has performed.
IObservable GetAllUserPerformed(string user);
///
@@ -174,7 +203,6 @@ public interface IObservableEventsClient
///
/// The login of the user
/// Options for changing the API response
- /// All the s that a particular user has performed.
IObservable GetAllUserPerformed(string user, ApiOptions options);
///
@@ -184,7 +212,6 @@ public interface IObservableEventsClient
/// http://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user
///
/// The login of the user
- /// All the public s that a particular user has performed.
IObservable GetAllUserPerformedPublic(string user);
///
@@ -195,7 +222,6 @@ public interface IObservableEventsClient
///
/// The login of the user
/// Options for changing the API response
- /// All the public s that a particular user has performed.
IObservable GetAllUserPerformedPublic(string user, ApiOptions options);
///
@@ -206,7 +232,6 @@ public interface IObservableEventsClient
///
/// The login of the user
/// The name of the organization
- /// All the public s that are associated with an organization.
IObservable GetAllForAnOrganization(string user, string organization);
///
@@ -218,7 +243,6 @@ public interface IObservableEventsClient
/// The login of the user
/// The name of the organization
/// Options for changing the API response
- /// All the public s that are associated with an organization.
IObservable GetAllForAnOrganization(string user, string organization, ApiOptions options);
}
}
\ No newline at end of file
diff --git a/Octokit.Reactive/Clients/ObservableEventsClient.cs b/Octokit.Reactive/Clients/ObservableEventsClient.cs
index 40eba047ff..dbfd2315cc 100644
--- a/Octokit.Reactive/Clients/ObservableEventsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableEventsClient.cs
@@ -3,6 +3,12 @@
namespace Octokit.Reactive
{
+ ///
+ /// A client for GitHub's Activity Events API.
+ ///
+ ///
+ /// See the Activity Events API documentation for more information
+ ///
public class ObservableEventsClient : IObservableEventsClient
{
readonly IConnection _connection;
@@ -20,7 +26,6 @@ public ObservableEventsClient(IGitHubClient client)
///
/// http://developer.github.com/v3/activity/events/#list-public-events
///
- /// All the public s for the particular user.
public IObservable GetAll()
{
return GetAll(ApiOptions.None);
@@ -33,7 +38,6 @@ public IObservable GetAll()
/// http://developer.github.com/v3/activity/events/#list-public-events
///
/// Options for changing the API response
- /// All the public s for the particular user.
public IObservable GetAll(ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
@@ -49,7 +53,6 @@ public IObservable GetAll(ApiOptions options)
///
/// The owner of the repository
/// The name of the repository
- /// All the s for the particular repository.
public IObservable GetAllForRepository(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -58,6 +61,18 @@ public IObservable GetAllForRepository(string owner, string name)
return GetAllForRepository(owner, name, ApiOptions.None);
}
+ ///
+ /// Gets all the events for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ ///
+ /// The ID of the repository
+ public IObservable GetAllForRepository(int repositoryId)
+ {
+ return GetAllForRepository(repositoryId, ApiOptions.None);
+ }
+
///
/// Gets all the events for a given repository
///
@@ -67,7 +82,6 @@ public IObservable GetAllForRepository(string owner, string name)
/// The owner of the repository
/// The name of the repository
/// Options for changing the API response
- /// All the s for the particular repository.
public IObservable GetAllForRepository(string owner, string name, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -77,6 +91,21 @@ public IObservable GetAllForRepository(string owner, string name, ApiO
return _connection.GetAndFlattenAllPages(ApiUrls.Events(owner, name), options);
}
+ ///
+ /// Gets all the events for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ ///
+ /// The ID of the repository
+ /// Options for changing the API response
+ public IObservable GetAllForRepository(int repositoryId, ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.Events(repositoryId), options);
+ }
+
///
/// Gets all the events for a given repository
///
@@ -85,7 +114,6 @@ public IObservable GetAllForRepository(string owner, string name, ApiO
///
/// The owner of the repository
/// The name of the repository
- /// All the s for the particular repository.
public IObservable GetAllIssuesForRepository(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -94,6 +122,18 @@ public IObservable GetAllIssuesForRepository(string owner, string name
return GetAllIssuesForRepository(owner, name, ApiOptions.None);
}
+ ///
+ /// Gets all the issue events for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ ///
+ /// The ID of the repository
+ public IObservable GetAllIssuesForRepository(int repositoryId)
+ {
+ return GetAllIssuesForRepository(repositoryId, ApiOptions.None);
+ }
+
///
/// Gets all the events for a given repository
///
@@ -103,7 +143,6 @@ public IObservable GetAllIssuesForRepository(string owner, string name
/// The owner of the repository
/// The name of the repository
/// Options for changing the API response
- /// All the s for the particular repository.
public IObservable GetAllIssuesForRepository(string owner, string name, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -113,6 +152,21 @@ public IObservable GetAllIssuesForRepository(string owner, string name
return _connection.GetAndFlattenAllPages(ApiUrls.IssuesEvents(owner, name), options);
}
+ ///
+ /// Gets all the issue events for a given repository
+ ///
+ ///
+ /// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
+ ///
+ /// The ID of the repository
+ /// Options for changing the API response
+ public IObservable GetAllIssuesForRepository(int repositoryId, ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.IssuesEvents(repositoryId), options);
+ }
+
///
/// Gets all the events for a given repository network
///
@@ -121,7 +175,6 @@ public IObservable GetAllIssuesForRepository(string owner, string name
///
/// The owner of the repository
/// The name of the repository
- /// All the s for the particular repository network.
public IObservable GetAllForRepositoryNetwork(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -139,7 +192,6 @@ public IObservable GetAllForRepositoryNetwork(string owner, string nam
/// The owner of the repository
/// The name of the repository
/// Options for changing the API response
- /// All the s for the particular repository network.
public IObservable GetAllForRepositoryNetwork(string owner, string name, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
@@ -156,7 +208,6 @@ public IObservable GetAllForRepositoryNetwork(string owner, string nam
/// http://developer.github.com/v3/activity/events/#list-public-events-for-an-organization
///
/// The name of the organization
- /// All the s for the particular organization.
public IObservable GetAllForOrganization(string organization)
{
Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
@@ -172,7 +223,6 @@ public IObservable GetAllForOrganization(string organization)
///
/// The name of the organization
/// Options for changing the API response
- /// All the s for the particular organization.
public IObservable GetAllForOrganization(string organization, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
@@ -188,7 +238,6 @@ public IObservable GetAllForOrganization(string organization, ApiOptio
/// http://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
///
/// The login of the user
- /// All the s that a particular user has received.
public IObservable GetAllUserReceived(string user)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
@@ -204,7 +253,6 @@ public IObservable GetAllUserReceived(string user)
///
/// The login of the user
/// Options for changing the API response
- /// All the s that a particular user has received.
public IObservable GetAllUserReceived(string user, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
@@ -220,7 +268,6 @@ public IObservable GetAllUserReceived(string user, ApiOptions options)
/// http://developer.github.com/v3/activity/events/#list-public-events-that-a-user-has-received
///
/// The login of the user
- /// All the s that a particular user has received.
public IObservable GetAllUserReceivedPublic(string user)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
@@ -236,7 +283,6 @@ public IObservable GetAllUserReceivedPublic(string user)
///
/// The login of the user
/// Options for changing the API response
- /// All the s that a particular user has received.
public IObservable GetAllUserReceivedPublic(string user, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
@@ -252,7 +298,6 @@ public IObservable GetAllUserReceivedPublic(string user, ApiOptions op
/// http://developer.github.com/v3/activity/events/#list-events-performed-by-a-user
///
/// The login of the user
- /// All the s that a particular user has performed.
public IObservable GetAllUserPerformed(string user)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
@@ -268,7 +313,6 @@ public IObservable GetAllUserPerformed(string user)
///
/// The login of the user
/// Options for changing the API response
- /// All the s that a particular user has performed.
public IObservable GetAllUserPerformed(string user, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
@@ -284,7 +328,6 @@ public IObservable GetAllUserPerformed(string user, ApiOptions options
/// http://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user
///
/// The login of the user
- /// All the public s that a particular user has performed.
public IObservable GetAllUserPerformedPublic(string user)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
@@ -300,7 +343,6 @@ public IObservable GetAllUserPerformedPublic(string user)
///
/// The login of the user
/// Options for changing the API response
- /// All the public s that a particular user has performed.
public IObservable GetAllUserPerformedPublic(string user, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
@@ -317,7 +359,6 @@ public IObservable GetAllUserPerformedPublic(string user, ApiOptions o
///
/// The login of the user
/// The name of the organization
- /// All the public s that are associated with an organization.
public IObservable GetAllForAnOrganization(string user, string organization)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
@@ -335,7 +376,6 @@ public IObservable GetAllForAnOrganization(string user, string organiz
/// The login of the user
/// The name of the organization
/// Options for changing the API response
- /// All the public s that are associated with an organization.
public IObservable GetAllForAnOrganization(string user, string organization, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
diff --git a/Octokit.Tests.Integration/Clients/EventsClientTests.cs b/Octokit.Tests.Integration/Clients/EventsClientTests.cs
index 10805a7677..d8cc1f0c25 100644
--- a/Octokit.Tests.Integration/Clients/EventsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/EventsClientTests.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
@@ -15,8 +14,283 @@ public async Task ReturnsACollection()
{
var github = Helper.GetAuthenticatedClient();
var events = await github.Activity.Events.GetAllUserPerformed("shiftkey");
+
+ Assert.NotEmpty(events);
+ }
+ }
+
+ public class TheGetAllForRepositoryMethod
+ {
+ [IntegrationTest]
+ public async Task CanListEvents()
+ {
+ var github = Helper.GetAuthenticatedClient();
+ var events = await github.Activity.Events.GetAllForRepository("octokit", "octokit.net");
+
+ Assert.NotEmpty(events);
+ }
+
+ [IntegrationTest]
+ public async Task CanListEventsWithRepositoryId()
+ {
+ var github = Helper.GetAuthenticatedClient();
+ var events = await github.Activity.Events.GetAllForRepository(7528679);
+
Assert.NotEmpty(events);
}
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfEventsWithoutStart()
+ {
+ var github = Helper.GetAuthenticatedClient();
+
+ var options = new ApiOptions
+ {
+ PageSize = 3,
+ PageCount = 1
+ };
+
+ var eventInfos = await github.Activity.Events.GetAllForRepository("octokit", "octokit.net", options);
+
+ Assert.Equal(3, eventInfos.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfEventsWithoutStartWitRepositoryId()
+ {
+ var github = Helper.GetAuthenticatedClient();
+
+ var options = new ApiOptions
+ {
+ PageSize = 3,
+ PageCount = 1
+ };
+
+ var eventInfos = await github.Activity.Events.GetAllForRepository(7528679, options);
+
+ Assert.Equal(3, eventInfos.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfEventsWithStart()
+ {
+ var github = Helper.GetAuthenticatedClient();
+
+ var options = new ApiOptions
+ {
+ PageSize = 2,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var eventInfos = await github.Activity.Events.GetAllForRepository("octokit", "octokit.net", options);
+
+ Assert.Equal(2, eventInfos.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsCorrectCountOfEventsWithStartWithRepositoryId()
+ {
+ var github = Helper.GetAuthenticatedClient();
+
+ var options = new ApiOptions
+ {
+ PageSize = 2,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var eventInfos = await github.Activity.Events.GetAllForRepository(7528679, options);
+
+ Assert.Equal(2, eventInfos.Count);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsDistinctEventsBasedOnStartPage()
+ {
+ var github = Helper.GetAuthenticatedClient();
+
+ var startOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1
+ };
+
+ var firstPage = await github.Activity.Events.GetAllForRepository("octokit", "octokit.net", startOptions);
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await github.Activity.Events.GetAllForRepository("octokit", "octokit.net", skipStartOptions);
+
+ Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
+ }
+
+ [IntegrationTest]
+ public async Task ReturnsDistinctEventsBasedOnStartPageWithRepositoryId()
+ {
+ var github = Helper.GetAuthenticatedClient();
+
+ var startOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1
+ };
+
+ var firstPage = await github.Activity.Events.GetAllForRepository(7528679, startOptions);
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await github.Activity.Events.GetAllForRepository(7528679, skipStartOptions);
+
+ Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
+ }
+ }
+
+ public class TheGetAllIssuesForRepositoryMethod
+ {
+ [IntegrationTest(Skip = "Fails because of SimpleJsonSerializer, see https://github.com/octokit/octokit.net/issues/1374 for details.")]
+ public async Task CanListIssues()
+ {
+ var github = Helper.GetAuthenticatedClient();
+ var issues = await github.Activity.Events.GetAllIssuesForRepository("octokit", "octokit.net");
+
+ Assert.NotEmpty(issues);
+ }
+
+ [IntegrationTest(Skip = "Fails because of SimpleJsonSerializer, see https://github.com/octokit/octokit.net/issues/1374 for details.")]
+ public async Task CanListIssuesWithRepositoryId()
+ {
+ var github = Helper.GetAuthenticatedClient();
+ var issues = await github.Activity.Events.GetAllIssuesForRepository(7528679);
+
+ Assert.NotEmpty(issues);
+ }
+
+ [IntegrationTest(Skip = "Fails because of SimpleJsonSerializer, see https://github.com/octokit/octokit.net/issues/1374 for details.")]
+ public async Task ReturnsCorrectCountOfEventsWithoutStart()
+ {
+ var github = Helper.GetAuthenticatedClient();
+
+ var options = new ApiOptions
+ {
+ PageSize = 3,
+ PageCount = 1
+ };
+
+ var eventInfos = await github.Activity.Events.GetAllIssuesForRepository("octokit", "octokit.net", options);
+
+ Assert.Equal(3, eventInfos.Count);
+ }
+
+ [IntegrationTest(Skip = "Fails because of SimpleJsonSerializer, see https://github.com/octokit/octokit.net/issues/1374 for details.")]
+ public async Task ReturnsCorrectCountOfEventsWithoutStartWitRepositoryId()
+ {
+ var github = Helper.GetAuthenticatedClient();
+
+ var options = new ApiOptions
+ {
+ PageSize = 3,
+ PageCount = 1
+ };
+
+ var eventInfos = await github.Activity.Events.GetAllIssuesForRepository(7528679, options);
+
+ Assert.Equal(3, eventInfos.Count);
+ }
+
+ [IntegrationTest(Skip = "Fails because of SimpleJsonSerializer, see https://github.com/octokit/octokit.net/issues/1374 for details.")]
+ public async Task ReturnsCorrectCountOfEventsWithStart()
+ {
+ var github = Helper.GetAuthenticatedClient();
+
+ var options = new ApiOptions
+ {
+ PageSize = 2,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var eventInfos = await github.Activity.Events.GetAllIssuesForRepository("octokit", "octokit.net", options);
+
+ Assert.Equal(2, eventInfos.Count);
+ }
+
+ [IntegrationTest(Skip = "Fails because of SimpleJsonSerializer, see https://github.com/octokit/octokit.net/issues/1374 for details.")]
+ public async Task ReturnsCorrectCountOfEventsWithStartWithRepositoryId()
+ {
+ var github = Helper.GetAuthenticatedClient();
+
+ var options = new ApiOptions
+ {
+ PageSize = 2,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var eventInfos = await github.Activity.Events.GetAllIssuesForRepository(7528679, options);
+
+ Assert.Equal(2, eventInfos.Count);
+ }
+
+ [IntegrationTest(Skip = "Fails because of SimpleJsonSerializer, see https://github.com/octokit/octokit.net/issues/1374 for details.")]
+ public async Task ReturnsDistinctEventsBasedOnStartPage()
+ {
+ var github = Helper.GetAuthenticatedClient();
+
+ var startOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1
+ };
+
+ var firstPage = await github.Activity.Events.GetAllIssuesForRepository("octokit", "octokit.net", startOptions);
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await github.Activity.Events.GetAllIssuesForRepository("octokit", "octokit.net", skipStartOptions);
+
+ Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
+ }
+
+ [IntegrationTest(Skip = "Fails because of SimpleJsonSerializer, see https://github.com/octokit/octokit.net/issues/1374 for details.")]
+ public async Task ReturnsDistinctEventsBasedOnStartPageWithRepositoryId()
+ {
+ var github = Helper.GetAuthenticatedClient();
+
+ var startOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1
+ };
+
+ var firstPage = await github.Activity.Events.GetAllIssuesForRepository(7528679, startOptions);
+
+ var skipStartOptions = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 2
+ };
+
+ var secondPage = await github.Activity.Events.GetAllIssuesForRepository(7528679, skipStartOptions);
+
+ Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
+ }
}
public class EventPayloads
diff --git a/Octokit.Tests/Clients/EventsClientTests.cs b/Octokit.Tests/Clients/EventsClientTests.cs
index d6171804df..6f543f7dc1 100644
--- a/Octokit.Tests/Clients/EventsClientTests.cs
+++ b/Octokit.Tests/Clients/EventsClientTests.cs
@@ -25,17 +25,18 @@ public void EnsuresNonNullArguments()
public class TheGetAllMethod
{
[Fact]
- public void RequestsCorrectUrl()
+ public async Task RequestsCorrectUrl()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
- client.GetAll();
+ await client.GetAll();
connection.Received().GetAll(Arg.Is(u => u.ToString() == "events"), Args.ApiOptions);
}
+
[Fact]
- public void RequestsCorrectUrlWithApiOptions()
+ public async Task RequestsCorrectUrlWithApiOptions()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
@@ -47,7 +48,7 @@ public void RequestsCorrectUrlWithApiOptions()
StartPage = 1
};
- client.GetAll(options);
+ await client.GetAll(options);
connection.Received().GetAll(Arg.Is(u => u.ToString() == "events"), options);
}
@@ -65,17 +66,29 @@ public async Task EnsuresNonNullArguments()
public class TheGetAllForRepositoryMethod
{
[Fact]
- public void RequestsCorrectUrl()
+ public async Task RequestsCorrectUrl()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
- client.GetAllForRepository("fake", "repo");
+ await client.GetAllForRepository("fake", "repo");
connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/events"), Args.ApiOptions);
}
+
+ [Fact]
+ public async Task RequestsCorrectUrlWithRepositoryId()
+ {
+ var connection = Substitute.For();
+ var client = new EventsClient(connection);
+
+ await client.GetAllForRepository(1);
+
+ connection.Received().GetAll(Arg.Is(u => u.ToString() == "repositories/1/events"), Args.ApiOptions);
+ }
+
[Fact]
- public void RequestsCorrectUrlWithApiOptions()
+ public async Task RequestsCorrectUrlWithApiOptions()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
@@ -87,24 +100,46 @@ public void RequestsCorrectUrlWithApiOptions()
StartPage = 1
};
-
- client.GetAllForRepository("fake", "repo", options);
+ await client.GetAllForRepository("fake", "repo", options);
connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/events"), options);
}
[Fact]
- public async Task EnsuresArgumentsNotNull()
+ public async Task RequestsCorrectUrlWithRepositoryIdWithApiOptions()
+ {
+ var connection = Substitute.For();
+ var client = new EventsClient(connection);
+
+ var options = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 1
+ };
+
+ await client.GetAllForRepository(1, options);
+
+ connection.Received().GetAll(Arg.Is(u => u.ToString() == "repositories/1/events"), options);
+ }
+
+ [Fact]
+ public async Task EnsuresNonNullArguments()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
await Assert.ThrowsAsync(() => client.GetAllForRepository(null, "name"));
- await Assert.ThrowsAsync(() => client.GetAllForRepository("", "name"));
await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", null));
+ await Assert.ThrowsAsync(() => client.GetAllForRepository(null, "name", ApiOptions.None));
+ await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", null, ApiOptions.None));
+ await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", "name", null));
+
+ await Assert.ThrowsAsync(() => client.GetAllForRepository(1, null));
+
+ await Assert.ThrowsAsync(() => client.GetAllForRepository("", "name"));
await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", ""));
- await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", "name",null));
- await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", "",ApiOptions.None));
+ await Assert.ThrowsAsync(() => client.GetAllForRepository("owner", "", ApiOptions.None));
await Assert.ThrowsAsync(() => client.GetAllForRepository("", "name", ApiOptions.None));
}
}
@@ -112,17 +147,29 @@ public async Task EnsuresArgumentsNotNull()
public class TheGetAllIssuesForRepositoryMethod
{
[Fact]
- public void RequestsCorrectUrl()
+ public async Task RequestsCorrectUrl()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
- client.GetAllIssuesForRepository("fake", "repo");
+ await client.GetAllIssuesForRepository("fake", "repo");
connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/events"), Args.ApiOptions);
}
+
[Fact]
- public void RequestsCorrectUrlWithApiOptions()
+ public async Task RequestsCorrectUrlWithRepositoryId()
+ {
+ var connection = Substitute.For();
+ var client = new EventsClient(connection);
+
+ await client.GetAllIssuesForRepository(1);
+
+ connection.Received().GetAll(Arg.Is(u => u.ToString() == "repositories/1/issues/events"), Args.ApiOptions);
+ }
+
+ [Fact]
+ public async Task RequestsCorrectUrlWithApiOptions()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
@@ -134,23 +181,45 @@ public void RequestsCorrectUrlWithApiOptions()
StartPage = 1
};
-
- client.GetAllIssuesForRepository("fake", "repo", options);
+ await client.GetAllIssuesForRepository("fake", "repo", options);
connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/events"), options);
}
[Fact]
- public async Task EnsuresArgumentsNotNull()
+ public async Task RequestsCorrectUrlWithRepositoryIdWithApiOptions()
+ {
+ var connection = Substitute.For();
+ var client = new EventsClient(connection);
+
+ var options = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 1
+ };
+
+ await client.GetAllIssuesForRepository(1, options);
+
+ connection.Received().GetAll(Arg.Is(u => u.ToString() == "repositories/1/issues/events"), options);
+ }
+
+ [Fact]
+ public async Task EnsuresNonNullArguments()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository(null, "name"));
- await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("", "name"));
await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("owner", null));
- await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("owner", ""));
+ await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository(null, "name", ApiOptions.None));
+ await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("owner", null, ApiOptions.None));
await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("owner", "name", null));
+
+ await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository(1, null));
+
+ await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("", "name"));
+ await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("owner", ""));
await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("owner", "", ApiOptions.None));
await Assert.ThrowsAsync(() => client.GetAllIssuesForRepository("", "name", ApiOptions.None));
}
@@ -159,18 +228,18 @@ public async Task EnsuresArgumentsNotNull()
public class TheGetAllForRepositoryNetworkMethod
{
[Fact]
- public void RequestsCorrectUrl()
+ public async Task RequestsCorrectUrl()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
- client.GetAllForRepositoryNetwork("fake", "repo");
+ await client.GetAllForRepositoryNetwork("fake", "repo");
connection.Received().GetAll(Arg.Is(u => u.ToString() == "networks/fake/repo/events"), Args.ApiOptions);
}
[Fact]
- public void RequestsCorrectUrlWithApiOptions()
+ public async Task RequestsCorrectUrlWithApiOptions()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
@@ -182,22 +251,26 @@ public void RequestsCorrectUrlWithApiOptions()
StartPage = 1
};
- client.GetAllForRepositoryNetwork("fake", "repo", options);
+ await client.GetAllForRepositoryNetwork("fake", "repo", options);
connection.Received().GetAll(Arg.Is(u => u.ToString() == "networks/fake/repo/events"), options);
}
[Fact]
- public async Task EnsuresArgumentsNotNull()
+ public async Task EnsuresNonNullArguments()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
await Assert.ThrowsAsync(() => client.GetAllForRepositoryNetwork(null, "name"));
- await Assert.ThrowsAsync(() => client.GetAllForRepositoryNetwork("", "name"));
await Assert.ThrowsAsync(() => client.GetAllForRepositoryNetwork("owner", null));
- await Assert.ThrowsAsync(() => client.GetAllForRepositoryNetwork("owner", ""));
+
+ await Assert.ThrowsAsync(() => client.GetAllForRepositoryNetwork(null, "name", ApiOptions.None));
+ await Assert.ThrowsAsync(() => client.GetAllForRepositoryNetwork("owner", null, ApiOptions.None));
await Assert.ThrowsAsync(() => client.GetAllForRepositoryNetwork("owner", "name", null));
+
+ await Assert.ThrowsAsync(() => client.GetAllForRepositoryNetwork("", "name"));
+ await Assert.ThrowsAsync(() => client.GetAllForRepositoryNetwork("owner", ""));
await Assert.ThrowsAsync(() => client.GetAllForRepositoryNetwork("owner", "", ApiOptions.None));
await Assert.ThrowsAsync(() => client.GetAllForRepositoryNetwork("", "name", ApiOptions.None));
}
@@ -206,18 +279,18 @@ public async Task EnsuresArgumentsNotNull()
public class TheGetAllForOrganizationMethod
{
[Fact]
- public void RequestsCorrectUrl()
+ public async Task RequestsCorrectUrl()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
- client.GetAllForOrganization("fake");
+ await client.GetAllForOrganization("fake");
connection.Received().GetAll(Arg.Is(u => u.ToString() == "orgs/fake/events"), Args.ApiOptions);
}
[Fact]
- public void RequestsCorrectUrlWithApiOptions()
+ public async Task RequestsCorrectUrlWithApiOptions()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
@@ -229,20 +302,21 @@ public void RequestsCorrectUrlWithApiOptions()
StartPage = 1
};
- client.GetAllForOrganization("fake", options);
+ await client.GetAllForOrganization("fake", options);
connection.Received().GetAll(Arg.Is(u => u.ToString() == "orgs/fake/events"), options);
}
[Fact]
- public async Task EnsuresArgumentsNotNull()
+ public async Task EnsuresNonNullArguments()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
await Assert.ThrowsAsync(() => client.GetAllForOrganization(null));
- await Assert.ThrowsAsync(() => client.GetAllForOrganization(""));
await Assert.ThrowsAsync(() => client.GetAllForOrganization("fake", null));
+
+ await Assert.ThrowsAsync(() => client.GetAllForOrganization(""));
await Assert.ThrowsAsync(() => client.GetAllForOrganization("", ApiOptions.None));
}
}
@@ -250,18 +324,18 @@ public async Task EnsuresArgumentsNotNull()
public class TheGetUserReceivedMethod
{
[Fact]
- public void RequestsCorrectUrl()
+ public async Task RequestsCorrectUrl()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
- client.GetAllUserReceived("fake");
+ await client.GetAllUserReceived("fake");
connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/fake/received_events"), Args.ApiOptions);
}
[Fact]
- public void RequestsCorrectUrlWithApiOptions()
+ public async Task RequestsCorrectUrlWithApiOptions()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
@@ -273,20 +347,21 @@ public void RequestsCorrectUrlWithApiOptions()
StartPage = 1
};
- client.GetAllUserReceived("fake", options);
+ await client.GetAllUserReceived("fake", options);
connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/fake/received_events"), options);
}
[Fact]
- public async Task EnsuresArgumentsNotNull()
+ public async Task EnsuresNonNullArguments()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
await Assert.ThrowsAsync(() => client.GetAllUserReceived(null));
- await Assert.ThrowsAsync(() => client.GetAllUserReceived(""));
await Assert.ThrowsAsync(() => client.GetAllUserReceived("fake", null));
+
+ await Assert.ThrowsAsync(() => client.GetAllUserReceived(""));
await Assert.ThrowsAsync(() => client.GetAllUserReceived("", ApiOptions.None));
}
}
@@ -294,18 +369,18 @@ public async Task EnsuresArgumentsNotNull()
public class TheGetUserReceivedPublicMethod
{
[Fact]
- public void RequestsCorrectUrl()
+ public async Task RequestsCorrectUrl()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
- client.GetAllUserReceivedPublic("fake");
+ await client.GetAllUserReceivedPublic("fake");
connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/fake/received_events/public"), Args.ApiOptions);
}
[Fact]
- public void RequestsCorrectUrlWithApiOptions()
+ public async Task RequestsCorrectUrlWithApiOptions()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
@@ -317,20 +392,21 @@ public void RequestsCorrectUrlWithApiOptions()
StartPage = 1
};
- client.GetAllUserReceivedPublic("fake", options);
+ await client.GetAllUserReceivedPublic("fake", options);
connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/fake/received_events/public"), options);
}
[Fact]
- public async Task EnsuresArgumentsNotNull()
+ public async Task EnsuresNonNullArguments()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
await Assert.ThrowsAsync(() => client.GetAllUserReceivedPublic(null));
- await Assert.ThrowsAsync(() => client.GetAllUserReceivedPublic(""));
await Assert.ThrowsAsync(() => client.GetAllUserReceivedPublic("fake", null));
+
+ await Assert.ThrowsAsync(() => client.GetAllUserReceivedPublic(""));
await Assert.ThrowsAsync(() => client.GetAllUserReceivedPublic("", ApiOptions.None));
}
}
@@ -338,18 +414,18 @@ public async Task EnsuresArgumentsNotNull()
public class TheGetUserPerformedMethod
{
[Fact]
- public void RequestsCorrectUrl()
+ public async Task RequestsCorrectUrl()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
- client.GetAllUserPerformed("fake");
+ await client.GetAllUserPerformed("fake");
connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/fake/events"), Args.ApiOptions);
}
[Fact]
- public void RequestsCorrectUrlWithApiOptions()
+ public async Task RequestsCorrectUrlWithApiOptions()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
@@ -361,20 +437,21 @@ public void RequestsCorrectUrlWithApiOptions()
StartPage = 1
};
- client.GetAllUserPerformed("fake", options);
+ await client.GetAllUserPerformed("fake", options);
connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/fake/events"), options);
}
[Fact]
- public async Task EnsuresArgumentsNotNull()
+ public async Task EnsuresNonNullArguments()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
await Assert.ThrowsAsync(() => client.GetAllUserPerformed(null));
- await Assert.ThrowsAsync(() => client.GetAllUserPerformed(""));
await Assert.ThrowsAsync(() => client.GetAllUserPerformed("fake", null));
+
+ await Assert.ThrowsAsync(() => client.GetAllUserPerformed(""));
await Assert.ThrowsAsync(() => client.GetAllUserPerformed("", ApiOptions.None));
}
}
@@ -382,18 +459,18 @@ public async Task EnsuresArgumentsNotNull()
public class TheGetUserPerformedPublicMethod
{
[Fact]
- public void RequestsCorrectUrl()
+ public async Task RequestsCorrectUrl()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
- client.GetAllUserPerformedPublic("fake");
+ await client.GetAllUserPerformedPublic("fake");
connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/fake/events/public"), Args.ApiOptions);
}
[Fact]
- public void RequestsCorrectUrlWithApiOptions()
+ public async Task RequestsCorrectUrlWithApiOptions()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
@@ -405,39 +482,40 @@ public void RequestsCorrectUrlWithApiOptions()
StartPage = 1
};
- client.GetAllUserPerformedPublic("fake", options);
+ await client.GetAllUserPerformedPublic("fake", options);
connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/fake/events/public"), options);
}
[Fact]
- public async Task EnsuresArgumentsNotNull()
+ public async Task EnsuresNonNullArguments()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
await Assert.ThrowsAsync(() => client.GetAllUserPerformedPublic(null));
+ await Assert.ThrowsAsync(() => client.GetAllUserPerformedPublic("fake", null));
+
await Assert.ThrowsAsync(() => client.GetAllUserPerformedPublic(""));
- await Assert.ThrowsAsync(() => client.GetAllUserPerformedPublic("fake",null));
- await Assert.ThrowsAsync(() => client.GetAllUserPerformedPublic("",ApiOptions.None));
+ await Assert.ThrowsAsync(() => client.GetAllUserPerformedPublic("", ApiOptions.None));
}
}
public class TheGetForAnOrganizationMethod
{
[Fact]
- public void RequestsCorrectUrl()
+ public async Task RequestsCorrectUrl()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
- client.GetAllForAnOrganization("fake", "org");
+ await client.GetAllForAnOrganization("fake", "org");
connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/fake/events/orgs/org"), Args.ApiOptions);
}
[Fact]
- public void RequestsCorrectUrlWithApiOptions()
+ public async Task RequestsCorrectUrlWithApiOptions()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
@@ -449,22 +527,25 @@ public void RequestsCorrectUrlWithApiOptions()
StartPage = 1
};
- client.GetAllForAnOrganization("fake", "org", options);
+ await client.GetAllForAnOrganization("fake", "org", options);
connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/fake/events/orgs/org"), options);
}
[Fact]
- public async Task EnsuresArgumentsNotNull()
+ public async Task EnsuresNonNullArguments()
{
var connection = Substitute.For();
var client = new EventsClient(connection);
await Assert.ThrowsAsync(() => client.GetAllForAnOrganization(null, "org"));
- await Assert.ThrowsAsync(() => client.GetAllForAnOrganization("", "org"));
await Assert.ThrowsAsync(() => client.GetAllForAnOrganization("fake", null));
- await Assert.ThrowsAsync(() => client.GetAllForAnOrganization("fake", ""));
+ await Assert.ThrowsAsync(() => client.GetAllForAnOrganization(null, "org", ApiOptions.None));
+ await Assert.ThrowsAsync(() => client.GetAllForAnOrganization("fake", null, ApiOptions.None));
await Assert.ThrowsAsync(() => client.GetAllForAnOrganization("fake", "org", null));
+
+ await Assert.ThrowsAsync(() => client.GetAllForAnOrganization("", "org"));
+ await Assert.ThrowsAsync(() => client.GetAllForAnOrganization("fake", ""));
await Assert.ThrowsAsync(() => client.GetAllForAnOrganization("fake", "", ApiOptions.None));
await Assert.ThrowsAsync(() => client.GetAllForAnOrganization("", "org", ApiOptions.None));
}
diff --git a/Octokit.Tests/Reactive/ObservableEventsClientTests.cs b/Octokit.Tests/Reactive/ObservableEventsClientTests.cs
index bccf493cad..8d06a257d6 100644
--- a/Octokit.Tests/Reactive/ObservableEventsClientTests.cs
+++ b/Octokit.Tests/Reactive/ObservableEventsClientTests.cs
@@ -32,6 +32,33 @@ public void RequestsCorrectUrl()
gitHubClient.Connection.Received(1).Get>(new Uri("events", UriKind.Relative), Args.EmptyDictionary, null);
}
+
+ [Fact]
+ public void RequestsCorrectUrlWithApiOptions()
+ {
+ var gitHubClient = Substitute.For();
+ var client = new ObservableEventsClient(gitHubClient);
+
+ var options = new ApiOptions
+ {
+ PageSize = 1,
+ PageCount = 1,
+ StartPage = 1
+ };
+
+ client.GetAll(options);
+
+ gitHubClient.Connection.Received().Get>(new Uri("events", UriKind.Relative), Arg.Is>(d => d.Count == 2), null);
+ }
+
+ [Fact]
+ public void EnsuresNonNullArguments()
+ {
+ var gitHubClient = Substitute.For();
+ var client = new ObservableEventsClient(gitHubClient);
+
+ Assert.Throws(() => client.GetAll(null));
+ }
}
public class TheGetAllForRepositoryMethod
@@ -44,19 +71,78 @@ public void RequestsCorrectUrl()
client.GetAllForRepository("fake", "repo");
- gitHubClient.Connection.Received(1).Get>(new Uri("repos/fake/repo/events", UriKind.Relative), Args.EmptyDictionary, null);
+ gitHubClient.Connection.Received(1).Get>(new Uri("repos/fake/repo/events", UriKind.Relative),
+ Args.EmptyDictionary, null);
+ }
+
+ [Fact]
+ public void RequestsCorrectUrlWithRepositoryId()
+ {
+ var gitHubClient = Substitute.For();
+ var client = new ObservableEventsClient(gitHubClient);
+
+ client.GetAllForRepository(1);
+
+ gitHubClient.Connection.Received(1).Get>(new Uri("repositories/1/events", UriKind.Relative),
+ Args.EmptyDictionary, null);
+ }
+
+ [Fact]
+ public void RequestsCorrectUrlWithApiOptions()
+ {
+ var gitHubClient = Substitute.For