From 155073b1383af48ae0ba529ebcac814889ce6dc2 Mon Sep 17 00:00:00 2001
From: Brandon Everett <bme2010@gmail.com>
Date: Sat, 31 Dec 2016 04:21:40 -0500
Subject: [PATCH] [WIP] Rename Comment to ReviewComment (#1520)

* obsolete comment and add ReviewComment

* obsolete PullRequest.Comment and change to ReviewComment

* update ObservablePullRequestClient and interface to use ReviewComment

* fixed formatting issues
have Comment return new ReviewComment
---
 .../Clients/IObservablePullRequestsClient.cs  |  8 +++-
 ...servablePullRequestReviewCommentsClient.cs |  2 +-
 .../Clients/ObservablePullRequestsClient.cs   | 12 +++--
 ...equestReviewCommentReactionsClientTests.cs |  2 +-
 .../PullRequestReviewCommentsClientTests.cs   |  2 +-
 ...blePullRequestReviewCommentsClientTests.cs | 44 +++++++++----------
 Octokit/Clients/IPullRequestsClient.cs        | 11 ++++-
 Octokit/Clients/PullRequestsClient.cs         | 15 +++++--
 8 files changed, 61 insertions(+), 35 deletions(-)

diff --git a/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs b/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs
index 752024be3f..ad5dd7c97a 100644
--- a/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs
+++ b/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs
@@ -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; }
+
         /// <summary>
         /// Gets a single Pull Request by number.
         /// </summary>
diff --git a/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentsClient.cs b/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentsClient.cs
index 89bb8ea0c8..4caefcd4f4 100644
--- a/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentsClient.cs
+++ b/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentsClient.cs
@@ -20,7 +20,7 @@ public ObservablePullRequestReviewCommentsClient(IGitHubClient client)
         {
             Ensure.ArgumentNotNull(client, "client");
 
-            _client = client.PullRequest.Comment;
+            _client = client.PullRequest.ReviewComment;
             _connection = client.Connection;
         }
 
diff --git a/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs b/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs
index be36824697..912d0fe293 100644
--- a/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs
+++ b/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs
@@ -16,9 +16,15 @@ 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; }
 
         public ObservablePullRequestsClient(IGitHubClient client)
         {
@@ -26,7 +32,7 @@ public ObservablePullRequestsClient(IGitHubClient client)
 
             _client = client.Repository.PullRequest;
             _connection = client.Connection;
-            Comment = new ObservablePullRequestReviewCommentsClient(client);
+            ReviewComment = new ObservablePullRequestReviewCommentsClient(client);
         }
 
         /// <summary>
diff --git a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs
index 92f21dc963..4044adde88 100644
--- a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs
@@ -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;
diff --git a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs
index 86c9c14ad7..ac9ab891bd 100644
--- a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs
@@ -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;
diff --git a/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs b/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs
index 7e637dbdec..4afdee43b4 100644
--- a/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs
+++ b/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -494,7 +494,7 @@ public void RequestsCorrectUrlWithoutSelectedSortingArgumentsWithRepositoryId()
 
                 client.GetAllForRepository(1);
 
-                gitHubClient.Received().PullRequest.Comment.GetAllForRepository(1);
+                gitHubClient.Received().PullRequest.ReviewComment.GetAllForRepository(1);
             }
 
             [Fact]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
@@ -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]
diff --git a/Octokit/Clients/IPullRequestsClient.cs b/Octokit/Clients/IPullRequestsClient.cs
index 04b5418b1b..ccb1315856 100644
--- a/Octokit/Clients/IPullRequestsClient.cs
+++ b/Octokit/Clients/IPullRequestsClient.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 using System.Diagnostics.CodeAnalysis;
 using System.Threading.Tasks;
 
@@ -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>
+        /// Client for managing review comments.
+        /// </summary>
+        IPullRequestReviewCommentsClient ReviewComment { get; }
+
         /// <summary>
         /// Get a pull request by number.
         /// </summary>
diff --git a/Octokit/Clients/PullRequestsClient.cs b/Octokit/Clients/PullRequestsClient.cs
index dad64321b6..81ea33ffed 100644
--- a/Octokit/Clients/PullRequestsClient.cs
+++ b/Octokit/Clients/PullRequestsClient.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 using System.Net;
 using System.Threading.Tasks;
 
@@ -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.