From b7f52d6c27cb44caf2cc1382895937bb54445bf0 Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 15 Jun 2016 16:05:32 +0700 Subject: [PATCH] added integration tests --- .../CommitCommentReactionsClientTests.cs | 75 ++++++++++++++++++- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/Octokit.Tests.Integration/Clients/CommitCommentReactionsClientTests.cs b/Octokit.Tests.Integration/Clients/CommitCommentReactionsClientTests.cs index 14e749b6..15508d52 100644 --- a/Octokit.Tests.Integration/Clients/CommitCommentReactionsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/CommitCommentReactionsClientTests.cs @@ -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); + + Assert.Equal(ReactionType.Confused, reaction.Content); + + Assert.Equal(result.User.Id, reaction.User.Id); + } + public void Dispose() { _context.Dispose();