Implement AssigneesClient

Implement client to list and check available assignees for a repository
This commit is contained in:
Haacked
2013-10-22 17:24:35 -07:00
parent 70b94187b3
commit e1d618dcaa
18 changed files with 309 additions and 10 deletions
@@ -0,0 +1,50 @@
using System.Linq;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
using Xunit;
public class AssigneesClientTests
{
readonly IGitHubClient _gitHubClient;
readonly Repository _repository;
readonly string _owner;
public AssigneesClientTests()
{
_gitHubClient = new GitHubClient("Test Runner User Agent")
{
Credentials = Helper.Credentials
};
var repoName = Helper.MakeNameWithTimestamp("public-repo");
_repository = _gitHubClient.Repository.Create(new NewRepository { Name = repoName }).Result;
_owner = _repository.Owner.Login;
}
[IntegrationTest]
public async Task CanCheckAssignees()
{
var isAssigned = await
_gitHubClient.Issue.Assignee.CheckAssignee(_owner, _repository.Name, "FakeHaacked");
Assert.False(isAssigned);
// Repository owner is always an assignee
isAssigned = await
_gitHubClient.Issue.Assignee.CheckAssignee(_owner, _repository.Name, _owner);
Assert.True(isAssigned);
}
[IntegrationTest]
public async Task CanListAssignees()
{
// Repository owner is always an assignee
var assignees = await _gitHubClient.Issue.Assignee.GetForRepository(_owner, _repository.Name);
Assert.True(assignees.Any(u => u.Login == Helper.Credentials.Login));
}
public void Dispose()
{
Helper.DeleteRepo(_repository);
}
}