foreach loop for reaction types in integration tests

This commit is contained in:
Martin Scholz
2016-06-23 08:35:04 +02:00
parent d700433440
commit f7a464cc3a
4 changed files with 32 additions and 136 deletions
@@ -40,42 +40,16 @@ public class PullRequestReviewCommentReactionsClientTests : IDisposable
AssertComment(commentFromGitHub, body, position);
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);
foreach (ReactionType reactionType in Enum.GetValues(typeof(ReactionType)))
{
var newReaction = new NewReaction(reactionType);
Assert.IsType<Reaction>(reactionConfused);
Assert.Equal(ReactionType.Confused, reactionConfused.Content);
Assert.Equal(commentFromGitHub.User.Id, reactionConfused.User.Id);
var reaction = await _github.Reaction.CommitComment.Create(_context.RepositoryOwner, _context.RepositoryName, commentFromGitHub.Id, newReaction);
Assert.IsType<Reaction>(reactionHeart);
Assert.Equal(ReactionType.Heart, reactionHeart.Content);
Assert.Equal(commentFromGitHub.User.Id, reactionHeart.User.Id);
Assert.IsType<Reaction>(reactionHooray);
Assert.Equal(ReactionType.Hooray, reactionHooray.Content);
Assert.Equal(commentFromGitHub.User.Id, reactionHooray.User.Id);
Assert.IsType<Reaction>(reactionLaugh);
Assert.Equal(ReactionType.Laugh, reactionLaugh.Content);
Assert.Equal(commentFromGitHub.User.Id, reactionLaugh.User.Id);
Assert.IsType<Reaction>(reactionMinus1);
Assert.Equal(ReactionType.Minus1, reactionMinus1.Content);
Assert.Equal(commentFromGitHub.User.Id, reactionMinus1.User.Id);
Assert.IsType<Reaction>(reactionPlus1);
Assert.Equal(ReactionType.Plus1, reactionPlus1.Content);
Assert.Equal(commentFromGitHub.User.Id, reactionPlus1.User.Id);
Assert.IsType<Reaction>(reaction);
Assert.Equal(reactionType, reaction.Content);
Assert.Equal(commentFromGitHub.User.Id, reaction.User.Id);
}
}
/// <summary>