mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-05-29 17:32:44 +00:00
added integration tests
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
using Octokit;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit;
|
||||
using Octokit.Tests.Integration;
|
||||
using Octokit.Tests.Integration.Helpers;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
|
||||
public class IssueCommentReactionsClientTests
|
||||
@@ -21,6 +21,52 @@ public class IssueCommentReactionsClientTests
|
||||
_context = _github.CreateRepositoryContext(new NewRepository(repoName)).Result;
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanListReactions()
|
||||
{
|
||||
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
|
||||
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
|
||||
|
||||
Assert.NotNull(issue);
|
||||
|
||||
var issueComment = await _issuesClient.Comment.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, "A test comment");
|
||||
|
||||
Assert.NotNull(issueComment);
|
||||
|
||||
var issueCommentReaction = await _github.Reaction.IssueComment.Create(_context.RepositoryOwner, _context.RepositoryName, issueComment.Id, new NewReaction(ReactionType.Heart));
|
||||
|
||||
var reactions = await _github.Reaction.IssueComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, issueComment.Id);
|
||||
|
||||
Assert.NotEmpty(reactions);
|
||||
|
||||
Assert.Equal(reactions[0].Id, issueCommentReaction.Id);
|
||||
|
||||
Assert.Equal(reactions[0].Content, issueCommentReaction.Content);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanListReactionsWithRepositoryId()
|
||||
{
|
||||
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
|
||||
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
|
||||
|
||||
Assert.NotNull(issue);
|
||||
|
||||
var issueComment = await _issuesClient.Comment.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, "A test comment");
|
||||
|
||||
Assert.NotNull(issueComment);
|
||||
|
||||
var issueCommentReaction = await _github.Reaction.IssueComment.Create(_context.Repository.Id, issueComment.Id, new NewReaction(ReactionType.Heart));
|
||||
|
||||
var reactions = await _github.Reaction.IssueComment.GetAll(_context.Repository.Id, issueComment.Id);
|
||||
|
||||
Assert.NotEmpty(reactions);
|
||||
|
||||
Assert.Equal(reactions[0].Id, issueCommentReaction.Id);
|
||||
|
||||
Assert.Equal(reactions[0].Content, issueCommentReaction.Content);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanCreateReaction()
|
||||
{
|
||||
@@ -44,6 +90,29 @@ public class IssueCommentReactionsClientTests
|
||||
Assert.Equal(issueComment.User.Id, issueCommentReaction.User.Id);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanCreateReactionWithRepositoryId()
|
||||
{
|
||||
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
|
||||
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
|
||||
|
||||
Assert.NotNull(issue);
|
||||
|
||||
var issueComment = await _issuesClient.Comment.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, "A test comment");
|
||||
|
||||
Assert.NotNull(issueComment);
|
||||
|
||||
var issueCommentReaction = await _github.Reaction.IssueComment.Create(_context.Repository.Id, issueComment.Id, new NewReaction(ReactionType.Heart));
|
||||
|
||||
Assert.NotNull(issueCommentReaction);
|
||||
|
||||
Assert.IsType<Reaction>(issueCommentReaction);
|
||||
|
||||
Assert.Equal(ReactionType.Heart, issueCommentReaction.Content);
|
||||
|
||||
Assert.Equal(issueComment.User.Id, issueCommentReaction.User.Id);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_context.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user