Add new ctor to PublicRepositoryRequest taking "since" parameter as a long, and obsolete the old ctor that uses an int

Update tests to pass long datatype
This commit is contained in:
Ryan Gribble
2016-10-03 20:45:43 +10:00
parent 8dcb1db0da
commit 3409ae11ff
5 changed files with 17 additions and 6 deletions

View File

@@ -683,7 +683,7 @@ public class RepositoriesClientTests
{
var github = Helper.GetAuthenticatedClient();
var request = new PublicRepositoryRequest(32732250);
var request = new PublicRepositoryRequest(32732250L);
var repositories = await github.Repository.GetAllPublic(request);
Assert.NotNull(repositories);

View File

@@ -37,7 +37,7 @@ namespace Octokit.Tests.Integration
var github = Helper.GetAuthenticatedClient();
var client = new ObservableRepositoriesClient(github);
var request = new PublicRepositoryRequest(32732250);
var request = new PublicRepositoryRequest(32732250L);
var repositories = await client.GetAllPublic(request).ToArray();
Assert.NotEmpty(repositories);
Assert.Equal(32732252, repositories[0].Id);

View File

@@ -308,7 +308,7 @@ namespace Octokit.Tests.Clients
var connection = Substitute.For<IApiConnection>();
var client = new RepositoriesClient(connection);
await client.GetAllPublic(new PublicRepositoryRequest(364));
await client.GetAllPublic(new PublicRepositoryRequest(364L));
connection.Received()
.GetAll<Repository>(Arg.Is<Uri>(u => u.ToString() == "repositories?since=364"));
@@ -320,7 +320,7 @@ namespace Octokit.Tests.Clients
var connection = Substitute.For<IApiConnection>();
var client = new RepositoriesClient(connection);
await client.GetAllPublic(new PublicRepositoryRequest(364));
await client.GetAllPublic(new PublicRepositoryRequest(364L));
connection.Received()
.GetAll<Repository>(Arg.Is<Uri>(u => u.ToString() == "repositories?since=364"));

View File

@@ -311,7 +311,7 @@ namespace Octokit.Tests.Reactive
var repositoriesClient = new ObservableRepositoriesClient(gitHubClient);
var results = await repositoriesClient.GetAllPublic(new PublicRepositoryRequest(364)).ToArray();
var results = await repositoriesClient.GetAllPublic(new PublicRepositoryRequest(364L)).ToArray();
Assert.Equal(7, results.Length);
gitHubClient.Connection.Received(1).Get<List<Repository>>(firstPageUrl, null, null);

View File

@@ -1,4 +1,5 @@
using System.Diagnostics;
using System;
using System.Diagnostics;
using System.Globalization;
namespace Octokit
@@ -13,6 +14,7 @@ namespace Octokit
/// Initializes a new instance of the <see cref="PublicRepositoryRequest"/> class.
/// </summary>
/// <param name="since">The integer Id of the last Repository that youve seen.</param>
[Obsolete("Please use the alternative constructor taking a long, rather than int, typed parameter. This constructor will be removed in a future release.")]
public PublicRepositoryRequest(int since)
{
Ensure.ArgumentNotNull(since, "since");
@@ -20,6 +22,15 @@ namespace Octokit
Since = since;
}
/// <summary>
/// Initializes a new instance of the <see cref="PublicRepositoryRequest"/> class.
/// </summary>
/// <param name="since">The Id of the last Repository that youve seen.</param>
public PublicRepositoryRequest(long since)
{
Since = since;
}
/// <summary>
/// Gets or sets the integer Id of the last Repository that youve seen.
/// </summary>