mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-05 03:30:34 +00:00
added integration tests
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
using Octokit;
|
||||
using System;
|
||||
using System.Linq;
|
||||
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 CommitCommentReactionsClientTests
|
||||
@@ -44,6 +45,52 @@ public class CommitCommentReactionsClientTests
|
||||
return await client.Git.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, newCommit);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanListReactions()
|
||||
{
|
||||
var commit = await SetupCommitForRepository(_github);
|
||||
|
||||
var comment = new NewCommitComment("test");
|
||||
|
||||
var result = await _github.Repository.Comment.Create(_context.RepositoryOwner, _context.RepositoryName,
|
||||
commit.Sha, comment);
|
||||
|
||||
Assert.NotNull(result);
|
||||
|
||||
var newReaction = new NewReaction(ReactionType.Confused);
|
||||
var reaction = await _github.Reaction.CommitComment.Create(_context.RepositoryOwner, _context.RepositoryName, result.Id, newReaction);
|
||||
|
||||
var reactions = await _github.Reaction.CommitComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, result.Id);
|
||||
|
||||
Assert.NotEmpty(reactions);
|
||||
|
||||
var @default = reactions.FirstOrDefault(r => r.Id == reaction.Id);
|
||||
Assert.NotNull(@default);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanListReactionsWithRepositoryId()
|
||||
{
|
||||
var commit = await SetupCommitForRepository(_github);
|
||||
|
||||
var comment = new NewCommitComment("test");
|
||||
|
||||
var result = await _github.Repository.Comment.Create(_context.RepositoryOwner, _context.RepositoryName,
|
||||
commit.Sha, comment);
|
||||
|
||||
Assert.NotNull(result);
|
||||
|
||||
var newReaction = new NewReaction(ReactionType.Confused);
|
||||
var reaction = await _github.Reaction.CommitComment.Create(_context.Repository.Id, result.Id, newReaction);
|
||||
|
||||
var reactions = await _github.Reaction.CommitComment.GetAll(_context.Repository.Id, result.Id);
|
||||
|
||||
Assert.NotEmpty(reactions);
|
||||
|
||||
var @default = reactions.FirstOrDefault(r => r.Id == reaction.Id);
|
||||
Assert.NotNull(@default);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanCreateReaction()
|
||||
{
|
||||
@@ -66,6 +113,28 @@ public class CommitCommentReactionsClientTests
|
||||
Assert.Equal(result.User.Id, reaction.User.Id);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanCreateReactionWithRepositoryId()
|
||||
{
|
||||
var commit = await SetupCommitForRepository(_github);
|
||||
|
||||
var comment = new NewCommitComment("test");
|
||||
|
||||
var result = await _github.Repository.Comment.Create(_context.RepositoryOwner, _context.RepositoryName,
|
||||
commit.Sha, comment);
|
||||
|
||||
Assert.NotNull(result);
|
||||
|
||||
var newReaction = new NewReaction(ReactionType.Confused);
|
||||
var reaction = await _github.Reaction.CommitComment.Create(_context.Repository.Id, result.Id, newReaction);
|
||||
|
||||
Assert.IsType<Reaction>(reaction);
|
||||
|
||||
Assert.Equal(ReactionType.Confused, reaction.Content);
|
||||
|
||||
Assert.Equal(result.User.Id, reaction.User.Id);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_context.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user