From bdc222132b865ecf2e1d425cafa5f4d23ef5a656 Mon Sep 17 00:00:00 2001 From: Martin Scholz Date: Wed, 22 Jun 2016 08:32:44 +0200 Subject: [PATCH] test if all reactions can be created --- .../CommitCommentReactionsClientTests.cs | 38 ++++++++++++++++--- .../IssueCommentReactionsClientTests.cs | 37 +++++++++++++++--- .../Clients/IssueReactionsClientTests.cs | 37 +++++++++++++++--- ...equestReviewCommentReactionsClientTests.cs | 37 +++++++++++++++--- 4 files changed, 129 insertions(+), 20 deletions(-) diff --git a/Octokit.Tests.Integration/Clients/CommitCommentReactionsClientTests.cs b/Octokit.Tests.Integration/Clients/CommitCommentReactionsClientTests.cs index 14e749b6..38e66eb4 100644 --- a/Octokit.Tests.Integration/Clients/CommitCommentReactionsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/CommitCommentReactionsClientTests.cs @@ -56,14 +56,42 @@ public class CommitCommentReactionsClientTests Assert.NotNull(result); - var newReaction = new NewReaction(ReactionType.Confused); - var reaction = await _github.Reaction.CommitComment.Create(_context.RepositoryOwner, _context.RepositoryName, result.Id, newReaction); + var newReactionConfused = new NewReaction(ReactionType.Confused); + var newReactionHeart = new NewReaction(ReactionType.Heart); + var newReactionHooray = new NewReaction(ReactionType.Hooray); + var newReactionLaugh = new NewReaction(ReactionType.Laugh); + var newReactionMinus1 = new NewReaction(ReactionType.Minus1); + var newReactionPlus1 = new NewReaction(ReactionType.Plus1); + var reactionConfused = await _github.Reaction.CommitComment.Create(_context.RepositoryOwner, _context.RepositoryName, result.Id, newReactionConfused); + var reactionHeart = await _github.Reaction.CommitComment.Create(_context.RepositoryOwner, _context.RepositoryName, result.Id, newReactionHeart); + var reactionHooray = await _github.Reaction.CommitComment.Create(_context.RepositoryOwner, _context.RepositoryName, result.Id, newReactionHooray); + var reactionLaugh = await _github.Reaction.CommitComment.Create(_context.RepositoryOwner, _context.RepositoryName, result.Id, newReactionLaugh); + var reactionMinus1 = await _github.Reaction.CommitComment.Create(_context.RepositoryOwner, _context.RepositoryName, result.Id, newReactionMinus1); + var reactionPlus1 = await _github.Reaction.CommitComment.Create(_context.RepositoryOwner, _context.RepositoryName, result.Id, newReactionPlus1); - Assert.IsType(reaction); + Assert.IsType(reactionConfused); + Assert.Equal(ReactionType.Confused, reactionConfused.Content); + Assert.Equal(result.User.Id, reactionConfused.User.Id); - Assert.Equal(ReactionType.Confused, reaction.Content); + Assert.IsType(reactionHeart); + Assert.Equal(ReactionType.Heart, reactionHeart.Content); + Assert.Equal(result.User.Id, reactionHeart.User.Id); - Assert.Equal(result.User.Id, reaction.User.Id); + Assert.IsType(reactionHooray); + Assert.Equal(ReactionType.Hooray, reactionHooray.Content); + Assert.Equal(result.User.Id, reactionHooray.User.Id); + + Assert.IsType(reactionLaugh); + Assert.Equal(ReactionType.Laugh, reactionLaugh.Content); + Assert.Equal(result.User.Id, reactionLaugh.User.Id); + + Assert.IsType(reactionMinus1); + Assert.Equal(ReactionType.Minus1, reactionMinus1.Content); + Assert.Equal(result.User.Id, reactionMinus1.User.Id); + + Assert.IsType(reactionPlus1); + Assert.Equal(ReactionType.Plus1, reactionPlus1.Content); + Assert.Equal(result.User.Id, reactionPlus1.User.Id); } public void Dispose() diff --git a/Octokit.Tests.Integration/Clients/IssueCommentReactionsClientTests.cs b/Octokit.Tests.Integration/Clients/IssueCommentReactionsClientTests.cs index 210a551e..c896af91 100644 --- a/Octokit.Tests.Integration/Clients/IssueCommentReactionsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/IssueCommentReactionsClientTests.cs @@ -33,15 +33,42 @@ public class IssueCommentReactionsClientTests Assert.NotNull(issueComment); - var issueCommentReaction = await _github.Reaction.IssueComment.Create(_context.RepositoryOwner, _context.RepositoryName, issueComment.Id, new NewReaction(ReactionType.Heart)); + var newReactionConfused = new NewReaction(ReactionType.Confused); + var newReactionHeart = new NewReaction(ReactionType.Heart); + var newReactionHooray = new NewReaction(ReactionType.Hooray); + var newReactionLaugh = new NewReaction(ReactionType.Laugh); + var newReactionMinus1 = new NewReaction(ReactionType.Minus1); + var newReactionPlus1 = new NewReaction(ReactionType.Plus1); + var reactionConfused = await _github.Reaction.IssueComment.Create(_context.RepositoryOwner, _context.RepositoryName, issueComment.Id, newReactionConfused); + var reactionHeart = await _github.Reaction.IssueComment.Create(_context.RepositoryOwner, _context.RepositoryName, issueComment.Id, newReactionHeart); + var reactionHooray = await _github.Reaction.IssueComment.Create(_context.RepositoryOwner, _context.RepositoryName, issueComment.Id, newReactionHooray); + var reactionLaugh = await _github.Reaction.IssueComment.Create(_context.RepositoryOwner, _context.RepositoryName, issueComment.Id, newReactionLaugh); + var reactionMinus1 = await _github.Reaction.IssueComment.Create(_context.RepositoryOwner, _context.RepositoryName, issueComment.Id, newReactionMinus1); + var reactionPlus1 = await _github.Reaction.IssueComment.Create(_context.RepositoryOwner, _context.RepositoryName, issueComment.Id, newReactionPlus1); - Assert.NotNull(issueCommentReaction); + Assert.IsType(reactionConfused); + Assert.Equal(ReactionType.Confused, reactionConfused.Content); + Assert.Equal(issueComment.User.Id, reactionConfused.User.Id); - Assert.IsType(issueCommentReaction); + Assert.IsType(reactionHeart); + Assert.Equal(ReactionType.Heart, reactionHeart.Content); + Assert.Equal(issueComment.User.Id, reactionHeart.User.Id); - Assert.Equal(ReactionType.Heart, issueCommentReaction.Content); + Assert.IsType(reactionHooray); + Assert.Equal(ReactionType.Hooray, reactionHooray.Content); + Assert.Equal(issueComment.User.Id, reactionHooray.User.Id); - Assert.Equal(issueComment.User.Id, issueCommentReaction.User.Id); + Assert.IsType(reactionLaugh); + Assert.Equal(ReactionType.Laugh, reactionLaugh.Content); + Assert.Equal(issueComment.User.Id, reactionLaugh.User.Id); + + Assert.IsType(reactionMinus1); + Assert.Equal(ReactionType.Minus1, reactionMinus1.Content); + Assert.Equal(issueComment.User.Id, reactionMinus1.User.Id); + + Assert.IsType(reactionPlus1); + Assert.Equal(ReactionType.Plus1, reactionPlus1.Content); + Assert.Equal(issueComment.User.Id, reactionPlus1.User.Id); } public void Dispose() diff --git a/Octokit.Tests.Integration/Clients/IssueReactionsClientTests.cs b/Octokit.Tests.Integration/Clients/IssueReactionsClientTests.cs index 32f263fa..9bce57af 100644 --- a/Octokit.Tests.Integration/Clients/IssueReactionsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/IssueReactionsClientTests.cs @@ -29,15 +29,42 @@ public class IssueReactionsClientTests Assert.NotNull(issue); - var issueReaction = await _github.Reaction.Issue.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new NewReaction(ReactionType.Heart)); + var newReactionConfused = new NewReaction(ReactionType.Confused); + var newReactionHeart = new NewReaction(ReactionType.Heart); + var newReactionHooray = new NewReaction(ReactionType.Hooray); + var newReactionLaugh = new NewReaction(ReactionType.Laugh); + var newReactionMinus1 = new NewReaction(ReactionType.Minus1); + var newReactionPlus1 = new NewReaction(ReactionType.Plus1); + var reactionConfused = await _github.Reaction.Issue.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, newReactionConfused); + var reactionHeart = await _github.Reaction.Issue.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, newReactionHeart); + var reactionHooray = await _github.Reaction.Issue.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, newReactionHooray); + var reactionLaugh = await _github.Reaction.Issue.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, newReactionLaugh); + var reactionMinus1 = await _github.Reaction.Issue.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, newReactionMinus1); + var reactionPlus1 = await _github.Reaction.Issue.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, newReactionPlus1); - Assert.NotNull(issueReaction); + Assert.IsType(reactionConfused); + Assert.Equal(ReactionType.Confused, reactionConfused.Content); + Assert.Equal(issue.User.Id, reactionConfused.User.Id); - Assert.IsType(issueReaction); + Assert.IsType(reactionHeart); + Assert.Equal(ReactionType.Heart, reactionHeart.Content); + Assert.Equal(issue.User.Id, reactionHeart.User.Id); - Assert.Equal(ReactionType.Heart, issueReaction.Content); + Assert.IsType(reactionHooray); + Assert.Equal(ReactionType.Hooray, reactionHooray.Content); + Assert.Equal(issue.User.Id, reactionHooray.User.Id); - Assert.Equal(issue.User.Id, issueReaction.User.Id); + Assert.IsType(reactionLaugh); + Assert.Equal(ReactionType.Laugh, reactionLaugh.Content); + Assert.Equal(issue.User.Id, reactionLaugh.User.Id); + + Assert.IsType(reactionMinus1); + Assert.Equal(ReactionType.Minus1, reactionMinus1.Content); + Assert.Equal(issue.User.Id, reactionMinus1.User.Id); + + Assert.IsType(reactionPlus1); + Assert.Equal(ReactionType.Plus1, reactionPlus1.Content); + Assert.Equal(issue.User.Id, reactionPlus1.User.Id); } public void Dispose() diff --git a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs index b705bfa8..ea073a2e 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs @@ -40,15 +40,42 @@ public class PullRequestReviewCommentReactionsClientTests : IDisposable AssertComment(commentFromGitHub, body, position); - var pullRequestReviewCommentReaction = await _github.Reaction.PullRequestReviewComment.Create(_context.RepositoryOwner, _context.RepositoryName, commentFromGitHub.Id, new NewReaction(ReactionType.Heart)); + var newReactionConfused = new NewReaction(ReactionType.Confused); + var newReactionHeart = new NewReaction(ReactionType.Heart); + var newReactionHooray = new NewReaction(ReactionType.Hooray); + var newReactionLaugh = new NewReaction(ReactionType.Laugh); + var newReactionMinus1 = new NewReaction(ReactionType.Minus1); + var newReactionPlus1 = new NewReaction(ReactionType.Plus1); + var reactionConfused = await _github.Reaction.PullRequestReviewComment.Create(_context.RepositoryOwner, _context.RepositoryName, commentFromGitHub.Id, newReactionConfused); + var reactionHeart = await _github.Reaction.PullRequestReviewComment.Create(_context.RepositoryOwner, _context.RepositoryName, commentFromGitHub.Id, newReactionHeart); + var reactionHooray = await _github.Reaction.PullRequestReviewComment.Create(_context.RepositoryOwner, _context.RepositoryName, commentFromGitHub.Id, newReactionHooray); + var reactionLaugh = await _github.Reaction.PullRequestReviewComment.Create(_context.RepositoryOwner, _context.RepositoryName, commentFromGitHub.Id, newReactionLaugh); + var reactionMinus1 = await _github.Reaction.PullRequestReviewComment.Create(_context.RepositoryOwner, _context.RepositoryName, commentFromGitHub.Id, newReactionMinus1); + var reactionPlus1 = await _github.Reaction.PullRequestReviewComment.Create(_context.RepositoryOwner, _context.RepositoryName, commentFromGitHub.Id, newReactionPlus1); - Assert.NotNull(pullRequestReviewCommentReaction); + Assert.IsType(reactionConfused); + Assert.Equal(ReactionType.Confused, reactionConfused.Content); + Assert.Equal(commentFromGitHub.User.Id, reactionConfused.User.Id); - Assert.IsType(pullRequestReviewCommentReaction); + Assert.IsType(reactionHeart); + Assert.Equal(ReactionType.Heart, reactionHeart.Content); + Assert.Equal(commentFromGitHub.User.Id, reactionHeart.User.Id); - Assert.Equal(ReactionType.Heart, pullRequestReviewCommentReaction.Content); + Assert.IsType(reactionHooray); + Assert.Equal(ReactionType.Hooray, reactionHooray.Content); + Assert.Equal(commentFromGitHub.User.Id, reactionHooray.User.Id); - Assert.Equal(commentFromGitHub.User.Id, pullRequestReviewCommentReaction.User.Id); + Assert.IsType(reactionLaugh); + Assert.Equal(ReactionType.Laugh, reactionLaugh.Content); + Assert.Equal(commentFromGitHub.User.Id, reactionLaugh.User.Id); + + Assert.IsType(reactionMinus1); + Assert.Equal(ReactionType.Minus1, reactionMinus1.Content); + Assert.Equal(commentFromGitHub.User.Id, reactionMinus1.User.Id); + + Assert.IsType(reactionPlus1); + Assert.Equal(ReactionType.Plus1, reactionPlus1.Content); + Assert.Equal(commentFromGitHub.User.Id, reactionPlus1.User.Id); } ///