added integration tests

This commit is contained in:
aedampir@gmail.com
2016-06-15 16:05:32 +07:00
parent 52de714280
commit b7f52d6c27
@@ -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();