Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Comment to ReviewComment #1520

Merged
merged 4 commits into from
Dec 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Octokit.Reactive/Clients/IObservablePullRequestsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ namespace Octokit.Reactive
public interface IObservablePullRequestsClient
{
/// <summary>
/// Client for managing comments.
/// Client for managing review comments.
/// </summary>
[Obsolete("Please use IObservablePullRequestsClient.ReviewComment. This will be removed in a future version")]
IObservablePullRequestReviewCommentsClient Comment { get; }

/// <summary>
/// Client for managing review comments.
/// </summary>
IObservablePullRequestReviewCommentsClient ReviewComment { get; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate the old member and the new member with a line of whitespace, and dont forget to add XmlDoc for the new member

eg:

/// <summary>
/// Client for managing comments.
/// </summary>
[Obsolete("Please use IObservablePullRequestsClient.ReviewComment. This will be removed in a future version")]
IObservablePullRequestReviewCommentsClient Comment { get; }		          

/// <summary>
/// Client for managing review comments.
/// </summary>
IObservablePullRequestReviewCommentsClient ReviewComment { get; }


/// <summary>
/// Gets a single Pull Request by number.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public ObservablePullRequestReviewCommentsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");

_client = client.PullRequest.Comment;
_client = client.PullRequest.ReviewComment;
_connection = client.Connection;
}

Expand Down
12 changes: 9 additions & 3 deletions Octokit.Reactive/Clients/ObservablePullRequestsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,23 @@ public class ObservablePullRequestsClient : IObservablePullRequestsClient
readonly IConnection _connection;

/// <summary>
/// Client for managing comments.
/// Client for managing review comments.
/// </summary>
public IObservablePullRequestReviewCommentsClient Comment { get; private set; }
[Obsolete("Please use ObservablePullRequestsClient.ReviewComment. This will be removed in a future version")]
public IObservablePullRequestReviewCommentsClient Comment { get { return this.ReviewComment; } }

/// <summary>
/// Client for managing review comments.
/// </summary>
public IObservablePullRequestReviewCommentsClient ReviewComment { get; private set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comments about whitespace and XmlDoc here


public ObservablePullRequestsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");

_client = client.Repository.PullRequest;
_connection = client.Connection;
Comment = new ObservablePullRequestReviewCommentsClient(client);
ReviewComment = new ObservablePullRequestReviewCommentsClient(client);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public PullRequestReviewCommentReactionsClientTests()
{
_github = Helper.GetAuthenticatedClient();

_client = _github.PullRequest.Comment;
_client = _github.PullRequest.ReviewComment;

// We'll create a pull request that can be used by most tests
_context = _github.CreateRepositoryContext("test-repo").Result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public PullRequestReviewCommentsClientTests()
{
_github = Helper.GetAuthenticatedClient();

_client = _github.PullRequest.Comment;
_client = _github.PullRequest.ReviewComment;

// We'll create a pull request that can be used by most tests
_context = _github.CreateRepositoryContext("test-repo").Result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void RequestsCorrectUrl()

client.GetAll("fake", "repo", 1);

gitHubClient.Received().PullRequest.Comment.GetAll("fake", "repo", 1);
gitHubClient.Received().PullRequest.ReviewComment.GetAll("fake", "repo", 1);
}

[Fact]
Expand All @@ -49,7 +49,7 @@ public void RequestsCorrectUrlWithRepositoryId()

client.GetAll(1, 1);

gitHubClient.Received().PullRequest.Comment.GetAll(1, 1);
gitHubClient.Received().PullRequest.ReviewComment.GetAll(1, 1);
}

[Fact]
Expand All @@ -67,7 +67,7 @@ public void RequestsCorrectUrlWithApiOptions()

client.GetAll("fake", "repo", 1, options);

gitHubClient.Received().PullRequest.Comment.GetAll("fake", "repo", 1, options);
gitHubClient.Received().PullRequest.ReviewComment.GetAll("fake", "repo", 1, options);
}

[Fact]
Expand All @@ -85,7 +85,7 @@ public void RequestsCorrectUrlWithApiOptionsWithRepositoryId()

client.GetAll(1, 1, options);

gitHubClient.Received().PullRequest.Comment.GetAll(1, 1, options);
gitHubClient.Received().PullRequest.ReviewComment.GetAll(1, 1, options);
}

[Fact]
Expand Down Expand Up @@ -237,7 +237,7 @@ public void RequestsCorrectUrl()

client.GetAllForRepository("fake", "repo", request);

gitHubClient.Received().PullRequest.Comment.GetAllForRepository("fake", "repo", request);
gitHubClient.Received().PullRequest.ReviewComment.GetAllForRepository("fake", "repo", request);
}

[Fact]
Expand All @@ -255,7 +255,7 @@ public void RequestsCorrectUrlWithRepositoryId()

client.GetAllForRepository(1, request);

gitHubClient.Received().PullRequest.Comment.GetAllForRepository(1, request);
gitHubClient.Received().PullRequest.ReviewComment.GetAllForRepository(1, request);
}

[Fact]
Expand All @@ -280,7 +280,7 @@ public void RequestsCorrectUrlWithApiOptions()

client.GetAllForRepository("fake", "repo", request, options);

gitHubClient.Received().PullRequest.Comment.GetAllForRepository("fake", "repo", request, options);
gitHubClient.Received().PullRequest.ReviewComment.GetAllForRepository("fake", "repo", request, options);
}

[Fact]
Expand All @@ -305,7 +305,7 @@ public void RequestsCorrectUrlWithApiOptionsWithRepositoryId()

client.GetAllForRepository(1, request, options);

gitHubClient.Received().PullRequest.Comment.GetAllForRepository(1, request, options);
gitHubClient.Received().PullRequest.ReviewComment.GetAllForRepository(1, request, options);
}

[Fact]
Expand Down Expand Up @@ -483,7 +483,7 @@ public void RequestsCorrectUrlWithoutSelectedSortingArguments()

client.GetAllForRepository("fake", "repo");

gitHubClient.Received().PullRequest.Comment.GetAllForRepository("fake", "repo");
gitHubClient.Received().PullRequest.ReviewComment.GetAllForRepository("fake", "repo");
}

[Fact]
Expand All @@ -494,7 +494,7 @@ public void RequestsCorrectUrlWithoutSelectedSortingArgumentsWithRepositoryId()

client.GetAllForRepository(1);

gitHubClient.Received().PullRequest.Comment.GetAllForRepository(1);
gitHubClient.Received().PullRequest.ReviewComment.GetAllForRepository(1);
}

[Fact]
Expand All @@ -512,7 +512,7 @@ public void RequestsCorrectUrlWithoutSelectedSortingArgumentsWithApiOptions()

client.GetAllForRepository("fake", "repo", options);

gitHubClient.Received().PullRequest.Comment.GetAllForRepository("fake", "repo", options);
gitHubClient.Received().PullRequest.ReviewComment.GetAllForRepository("fake", "repo", options);
}

[Fact]
Expand All @@ -530,7 +530,7 @@ public void RequestsCorrectUrlWithoutSelectedSortingArgumentsWithApiOptionsWithR

client.GetAllForRepository(1, options);

gitHubClient.Received().PullRequest.Comment.GetAllForRepository(1, options);
gitHubClient.Received().PullRequest.ReviewComment.GetAllForRepository(1, options);
}

[Fact]
Expand Down Expand Up @@ -721,7 +721,7 @@ public void GetsFromClientPullRequestComment()

client.GetComment("owner", "name", 53);

gitHubClient.PullRequest.Comment.Received().GetComment("owner", "name", 53);
gitHubClient.PullRequest.ReviewComment.Received().GetComment("owner", "name", 53);
}

[Fact]
Expand All @@ -732,7 +732,7 @@ public void GetsFromClientPullRequestCommentWithRepositoryId()

client.GetComment(1, 53);

gitHubClient.PullRequest.Comment.Received().GetComment(1, 53);
gitHubClient.PullRequest.ReviewComment.Received().GetComment(1, 53);
}

[Fact]
Expand Down Expand Up @@ -760,7 +760,7 @@ public void PostsToCorrectUrl()

client.Create("owner", "name", 13, comment);

gitHubClient.PullRequest.Comment.Received().Create("owner", "name", 13, comment);
gitHubClient.PullRequest.ReviewComment.Received().Create("owner", "name", 13, comment);
}

[Fact]
Expand All @@ -773,7 +773,7 @@ public void PostsToCorrectUrlWithRepositoryId()

client.Create(1, 13, comment);

gitHubClient.PullRequest.Comment.Received().Create(1, 13, comment);
gitHubClient.PullRequest.ReviewComment.Received().Create(1, 13, comment);
}

[Fact]
Expand Down Expand Up @@ -812,7 +812,7 @@ public void PostsToCorrectUrl()

client.CreateReply("owner", "name", 13, comment);

gitHubClient.PullRequest.Comment.Received().CreateReply("owner", "name", 13, comment);
gitHubClient.PullRequest.ReviewComment.Received().CreateReply("owner", "name", 13, comment);
}

[Fact]
Expand All @@ -825,7 +825,7 @@ public void PostsToCorrectUrlWithRepositoryId()

client.CreateReply(1, 13, comment);

gitHubClient.PullRequest.Comment.Received().CreateReply(1, 13, comment);
gitHubClient.PullRequest.ReviewComment.Received().CreateReply(1, 13, comment);
}

[Fact]
Expand Down Expand Up @@ -862,7 +862,7 @@ public void PostsToCorrectUrl()

client.Edit("owner", "name", 13, comment);

gitHubClient.PullRequest.Comment.Received().Edit("owner", "name", 13, comment);
gitHubClient.PullRequest.ReviewComment.Received().Edit("owner", "name", 13, comment);
}

[Fact]
Expand All @@ -875,7 +875,7 @@ public void PostsToCorrectUrlWithRepositoryId()

client.Edit(1, 13, comment);

gitHubClient.PullRequest.Comment.Received().Edit(1, 13, comment);
gitHubClient.PullRequest.ReviewComment.Received().Edit(1, 13, comment);
}

[Fact]
Expand Down Expand Up @@ -909,7 +909,7 @@ public void PostsToCorrectUrl()

client.Delete("owner", "name", 13);

gitHubClient.PullRequest.Comment.Received().Delete("owner", "name", 13);
gitHubClient.PullRequest.ReviewComment.Received().Delete("owner", "name", 13);
}

[Fact]
Expand All @@ -920,7 +920,7 @@ public void PostsToCorrectUrlWithRepositoryId()

client.Delete(1, 13);

gitHubClient.PullRequest.Comment.Received().Delete(1, 13);
gitHubClient.PullRequest.ReviewComment.Received().Delete(1, 13);
}

[Fact]
Expand Down
11 changes: 9 additions & 2 deletions Octokit/Clients/IPullRequestsClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;

Expand All @@ -13,10 +14,16 @@ namespace Octokit
public interface IPullRequestsClient
{
/// <summary>
/// Client for managing comments.
/// Client for managing review comments.
/// </summary>
[Obsolete("Please use IPullRequestsClient.ReviewComment instead. This method will be removed in a future version")]
IPullRequestReviewCommentsClient Comment { get; }

/// <summary>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix formatting (whitespace) here for consistency

/// Client for managing review comments.
/// </summary>
IPullRequestReviewCommentsClient ReviewComment { get; }

/// <summary>
/// Get a pull request by number.
/// </summary>
Expand Down
15 changes: 11 additions & 4 deletions Octokit/Clients/PullRequestsClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;

Expand All @@ -14,13 +15,19 @@ public class PullRequestsClient : ApiClient, IPullRequestsClient
{
public PullRequestsClient(IApiConnection apiConnection) : base(apiConnection)
{
Comment = new PullRequestReviewCommentsClient(apiConnection);
ReviewComment = new PullRequestReviewCommentsClient(apiConnection);
}

/// <summary>
/// Client for managing comments.
/// Client for managing review comments.
/// </summary>
public IPullRequestReviewCommentsClient Comment { get; private set; }
[Obsolete("Please use PullRequestsClient.ReviewComment instead. This method will be removed in a future version")]
public IPullRequestReviewCommentsClient Comment { get { return this.ReviewComment; } }

/// <summary>
/// Client for managing review comments.
/// </summary>
public IPullRequestReviewCommentsClient ReviewComment { get; set; }

/// <summary>
/// Get a pull request by number.
Expand Down