mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-20 06:05:12 +00:00
I was trying to create a repository and I wasn't sure which parameters were required. Following our philosophy of exposing required parameters in the constructor, I change the `NewRepository` object to take in a repository name and to make that property readonly.
48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
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 = Helper.GetAuthenticatedClient();
|
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
|
|
|
_repository = _gitHubClient.Repository.Create(new NewRepository(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.UserName));
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
Helper.DeleteRepo(_repository);
|
|
}
|
|
}
|