Replaces #1042
This commit is contained in:
Mordechai Zuber
2016-01-03 12:00:36 +02:00
parent 101692fb7c
commit b1917364cc
7 changed files with 60 additions and 18 deletions
@@ -313,8 +313,17 @@ namespace Octokit.Reactive
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
[System.Obsolete("Commit information is now available under the Commit property. This will be removed in a future update.")]
IObservableRepositoryCommitsClient Commits { get; }
/// <summary>
/// Client for GitHub's Repository Commits API
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
IObservableRepositoryCommitsClient Commit { get; }
/// <summary>
/// Client for managing pull requests.
/// </summary>
@@ -33,7 +33,10 @@ namespace Octokit.Reactive
RepositoryComments = new ObservableRepositoryCommentsClient(client);
#pragma warning restore CS0618 // Type or member is obsolete
Comment = new ObservableRepositoryCommentsClient(client);
#pragma warning disable CS0618 // Type or member is obsolete
Commits = new ObservableRepositoryCommitsClient(client);
#pragma warning restore CS0618 // Type or member is obsolete
Commit = new ObservableRepositoryCommitsClient(client);
DeployKeys = new ObservableRepositoryDeployKeysClient(client);
Content = new ObservableRepositoryContentsClient(client);
Merging = new ObservableMergingClient(client);
@@ -429,7 +432,7 @@ namespace Octokit.Reactive
/// <returns></returns>
public IObservable<CompareResult> Compare(string owner, string name, string @base, string head)
{
return _client.Commits.Compare(owner, name, @base, head).ToObservable();
return _client.Commit.Compare(owner, name, @base, head).ToObservable();
}
/// <summary>
@@ -455,8 +458,17 @@ namespace Octokit.Reactive
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
[Obsolete("Commit information is now available under the Commit property. This will be removed in a future update.")]
public IObservableRepositoryCommitsClient Commits { get; private set; }
/// <summary>
/// Client for GitHub's Repository Commits API
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
public IObservableRepositoryCommitsClient Commit { get; private set; }
/// <summary>
/// Client for managing pull requests.
/// </summary>
@@ -14,7 +14,7 @@ namespace Octokit.Reactive
Ensure.ArgumentNotNull(client, "client");
_connection = client.Connection;
_commit = client.Repository.Commits;
_commit = client.Repository.Commit;
}
/// <summary>
@@ -17,7 +17,7 @@ public class RepositoryCommitsClientTests
{
var client = Helper.GetAuthenticatedClient();
_fixture = client.Repository.Commits;
_fixture = client.Repository.Commit;
}
[IntegrationTest]
@@ -99,7 +99,7 @@ public class RepositoryCommitsClientTests
{
_github = Helper.GetAuthenticatedClient();
_fixture = _github.Repository.Commits;
_fixture = _github.Repository.Commit;
_context = _github.CreateRepositoryContext("source-repo").Result;
}
@@ -246,12 +246,12 @@ namespace Octokit.Tests.Reactive
{
var client = new ObservableRepositoriesClient(Substitute.For<IGitHubClient>());
Assert.Throws<ArgumentNullException>(() => client.Commits.Get(null, "repo", "reference"));
Assert.Throws<ArgumentNullException>(() => client.Commits.Get("owner", null, "reference"));
Assert.Throws<ArgumentNullException>(() => client.Commits.Get("owner", "repo", null));
Assert.Throws<ArgumentException>(() => client.Commits.Get("", "repo", "reference"));
Assert.Throws<ArgumentException>(() => client.Commits.Get("owner", "", "reference"));
Assert.Throws<ArgumentException>(() => client.Commits.Get("owner", "repo", ""));
Assert.Throws<ArgumentNullException>(() => client.Commit.Get(null, "repo", "reference"));
Assert.Throws<ArgumentNullException>(() => client.Commit.Get("owner", null, "reference"));
Assert.Throws<ArgumentNullException>(() => client.Commit.Get("owner", "repo", null));
Assert.Throws<ArgumentException>(() => client.Commit.Get("", "repo", "reference"));
Assert.Throws<ArgumentException>(() => client.Commit.Get("owner", "", "reference"));
Assert.Throws<ArgumentException>(() => client.Commit.Get("owner", "repo", ""));
}
[Fact]
@@ -260,9 +260,9 @@ namespace Octokit.Tests.Reactive
var github = Substitute.For<IGitHubClient>();
var client = new ObservableRepositoriesClient(github);
client.Commits.Get("owner", "repo", "reference");
client.Commit.Get("owner", "repo", "reference");
github.Repository.Commits.Received(1).Get("owner", "repo", "reference");
github.Repository.Commit.Received(1).Get("owner", "repo", "reference");
}
}
@@ -273,11 +273,11 @@ namespace Octokit.Tests.Reactive
{
var client = new ObservableRepositoriesClient(Substitute.For<IGitHubClient>());
Assert.Throws<ArgumentNullException>(() => client.Commits.GetAll(null, "repo"));
Assert.Throws<ArgumentNullException>(() => client.Commits.GetAll("owner", null));
Assert.Throws<ArgumentNullException>(() => client.Commits.GetAll("owner", "repo", null));
Assert.Throws<ArgumentException>(() => client.Commits.GetAll("", "repo"));
Assert.Throws<ArgumentException>(() => client.Commits.GetAll("owner", ""));
Assert.Throws<ArgumentNullException>(() => client.Commit.GetAll(null, "repo"));
Assert.Throws<ArgumentNullException>(() => client.Commit.GetAll("owner", null));
Assert.Throws<ArgumentNullException>(() => client.Commit.GetAll("owner", "repo", null));
Assert.Throws<ArgumentException>(() => client.Commit.GetAll("", "repo"));
Assert.Throws<ArgumentException>(() => client.Commit.GetAll("owner", ""));
}
[Fact]
@@ -287,7 +287,7 @@ namespace Octokit.Tests.Reactive
var client = new ObservableRepositoriesClient(github);
var expected = new Uri("repos/owner/repo/commits", UriKind.Relative);
client.Commits.GetAll("owner", "repo");
client.Commit.GetAll("owner", "repo");
github.Connection.Received(1).Get<List<GitHubCommit>>(expected, Arg.Any<IDictionary<string, string>>(), null);
}
+9
View File
@@ -259,8 +259,17 @@ namespace Octokit
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
[System.Obsolete("Commit information is now available under the Commit property. This will be removed in a future update.")]
IRepositoryCommitsClient Commits { get; }
/// <summary>
/// Client for GitHub's Repository Commits API
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
IRepositoryCommitsClient Commit { get; }
/// <summary>
/// Client for GitHub's Repository Merging API
/// </summary>
+12
View File
@@ -36,7 +36,10 @@ namespace Octokit
RepositoryComments = new RepositoryCommentsClient(apiConnection);
#pragma warning restore CS0618 // Type or member is obsolete
Comment = new RepositoryCommentsClient(apiConnection);
#pragma warning disable CS0618 // Type or member is obsolete
Commits = new RepositoryCommitsClient(apiConnection);
#pragma warning restore CS0618 // Type or member is obsolete
Commit = new RepositoryCommitsClient(apiConnection);
DeployKeys = new RepositoryDeployKeysClient(apiConnection);
Merging = new MergingClient(apiConnection);
Content = new RepositoryContentsClient(apiConnection);
@@ -376,8 +379,17 @@ namespace Octokit
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
[Obsolete("Commit information is now available under the Commit property. This will be removed in a future update.")]
public IRepositoryCommitsClient Commits { get; private set; }
/// <summary>
/// Client for GitHub's Repository Commits API
/// </summary>
/// <remarks>
/// See the <a href="http://developer.github.com/v3/repos/commits/">Commits API documentation</a> for more details
///</remarks>
public IRepositoryCommitsClient Commit { get; private set; }
/// <summary>
/// Client for GitHub's Repository Merging API
/// </summary>