示例#1
0
        /// <summary>
        /// Gets a single Issue Comment by id.
        /// </summary>
        /// <remarks>http://developer.github.com/v3/issues/comments/#get-a-single-comment</remarks>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="id">The issue comment id</param>
        public IObservable <IssueComment> Get(string owner, string name, int id)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
            Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));

            return(_client.Get(owner, name, id).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);
        }
示例#4
0
        /// <summary>
        /// Gets a single Issue Comment by number.
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/issues/comments/#get-a-single-comment
        /// </remarks>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="number">The issue comment number</param>
        /// <returns>The <see cref="IssueComment"/>s for the specified Issue Comment.</returns>
        public IObservable <IssueComment> Get(string owner, string name, int number)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");

            return(_client.Get(owner, name, number).ToObservable());
        }
        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 ReturnsIssueComment()
        {
            var comment = await _issueCommentsClient.Get(owner, name, id);

            Assert.NotNull(comment);
        }