mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-03 11:05:56 +00:00
added new integration tests
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
using Octokit;
|
||||
using System;
|
||||
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 IssueReactionsClientTests
|
||||
@@ -16,11 +16,49 @@ public class IssueReactionsClientTests
|
||||
public TheCreateReactionMethod()
|
||||
{
|
||||
_github = Helper.GetAuthenticatedClient();
|
||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||
|
||||
_issuesClient = _github.Issue;
|
||||
|
||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||
_context = _github.CreateRepositoryContext(new NewRepository(repoName)).Result;
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanListReactions()
|
||||
{
|
||||
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
|
||||
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
|
||||
|
||||
Assert.NotNull(issue);
|
||||
|
||||
var issueReaction = await _github.Reaction.Issue.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new NewReaction(ReactionType.Heart));
|
||||
|
||||
var issueReactions = await _github.Reaction.Issue.GetAll(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
|
||||
Assert.NotEmpty(issueReactions);
|
||||
|
||||
Assert.Equal(issueReaction.Id, issueReactions[0].Id);
|
||||
Assert.Equal(issueReaction.Content, issueReactions[0].Content);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanListReactionsWithRepositoryId()
|
||||
{
|
||||
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
|
||||
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
|
||||
|
||||
Assert.NotNull(issue);
|
||||
|
||||
var issueReaction = await _github.Reaction.Issue.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new NewReaction(ReactionType.Heart));
|
||||
|
||||
var issueReactions = await _github.Reaction.Issue.GetAll(_context.Repository.Id, issue.Number);
|
||||
|
||||
Assert.NotEmpty(issueReactions);
|
||||
|
||||
Assert.Equal(issueReaction.Id, issueReactions[0].Id);
|
||||
Assert.Equal(issueReaction.Content, issueReactions[0].Content);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanCreateReaction()
|
||||
{
|
||||
@@ -40,10 +78,28 @@ public class IssueReactionsClientTests
|
||||
Assert.Equal(issue.User.Id, issueReaction.User.Id);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanCreateReactionWithRepositoryId()
|
||||
{
|
||||
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
|
||||
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
|
||||
|
||||
Assert.NotNull(issue);
|
||||
|
||||
var issueReaction = await _github.Reaction.Issue.Create(_context.Repository.Id, issue.Number, new NewReaction(ReactionType.Heart));
|
||||
|
||||
Assert.NotNull(issueReaction);
|
||||
|
||||
Assert.IsType<Reaction>(issueReaction);
|
||||
|
||||
Assert.Equal(ReactionType.Heart, issueReaction.Content);
|
||||
|
||||
Assert.Equal(issue.User.Id, issueReaction.User.Id);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_context.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user