/// <summary> /// Creates a new Issue Comment for a specified Issue. /// </summary> /// <remarks>http://developer.github.com/v3/issues/comments/#create-a-comment</remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="number">The number of the issue</param> /// <param name="newComment">The text of the new comment</param> public IObservable <IssueComment> Create(string owner, string name, int number, string newComment) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNull(newComment, nameof(newComment)); return(_client.Create(owner, name, number, newComment).ToObservable()); }
public async Task DeleteIssueComment() { var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, new NewIssue("Super Issue 1")); var comment = await _issueCommentsClient.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, "test comment 1"); await _issueCommentsClient.Delete(_context.RepositoryOwner, _context.RepositoryName, comment.Id); await Assert.ThrowsAsync <NotFoundException>(() => _issueCommentsClient.Get(_context.RepositoryOwner, _context.RepositoryName, comment.Id)); }
public async Task ReturnsIssueComment() { var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, new NewIssue("Super Issue 1")); var comment = await _issueCommentsClient.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, "test comment 1"); var loadedComment = await _issueCommentsClient.Get(_context.RepositoryOwner, _context.RepositoryName, comment.Id); Assert.Equal(comment.Id, loadedComment.Id); Assert.Equal(comment.Body, loadedComment.Body); }
public async Task UpdateIssueComment() { var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, new NewIssue("Super Issue 1")); var comment = await _issueCommentsClient.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, "test comment 1"); var commentId = comment.Id; var beforeComment = await _issueCommentsClient.Get(_context.RepositoryOwner, _context.RepositoryName, commentId); await _issueCommentsClient.Update(_context.RepositoryOwner, _context.RepositoryName, commentId, "test comment 2"); var afterComment = await _issueCommentsClient.Get(_context.RepositoryOwner, _context.RepositoryName, commentId); Assert.Equal(beforeComment.Id, afterComment.Id); Assert.NotEqual(beforeComment.Body, afterComment.Body); Assert.Equal("test comment 2", afterComment.Body); }
public async Task SubmitComments() { using (new ScopeGuard(() => IsProcessing = true, () => IsProcessing = false)) { var comments = GenerateComments(); await _reviewClient.Create(_PullRequestLocator.Owner, _PullRequestLocator.Repository, _PullRequestLocator.PullRequestNumber, comments); } }