diff --git a/Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs b/Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs index 4205b44c..b025fc55 100644 --- a/Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs @@ -48,6 +48,29 @@ public class IssuesLabelsClientTests : IDisposable Assert.Equal(newLabel.Color, issueLabelsInfo[0].Color); } + [IntegrationTest] + public async Task CanListIssueLabelsForAnIssueWithRepositoryId() + { + var newIssue = new NewIssue("A test issue") { Body = "A new unassigned issue" }; + var newLabel = new NewLabel("test label", "FFFFFF"); + + var label = await _issuesLabelsClient.Create(_context.Repository.Id, newLabel); + var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); + + var issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.Repository.Id, issue.Number); + Assert.Empty(issueLabelsInfo); + + var issueUpdate = new IssueUpdate(); + issueUpdate.AddLabel(label.Name); + var updated = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, issueUpdate); + Assert.NotNull(updated); + + issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.Repository.Id, issue.Number); + + Assert.Equal(1, issueLabelsInfo.Count); + Assert.Equal(newLabel.Color, issueLabelsInfo[0].Color); + } + [IntegrationTest] public async Task ReturnsCorrectCountOfIssueLabelsWithoutStartForAnIssue() { @@ -77,6 +100,35 @@ public class IssuesLabelsClientTests : IDisposable Assert.Equal(newLabel.Color, issueLabelsInfo[0].Color); } + [IntegrationTest] + public async Task ReturnsCorrectCountOfIssueLabelsWithoutStartForAnIssueWithRepositoryId() + { + var newIssue = new NewIssue("A test issue") { Body = "A new unassigned issue" }; + var newLabel = new NewLabel("test label", "FFFFFF"); + + var label = await _issuesLabelsClient.Create(_context.Repository.Id, newLabel); + var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); + + var issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.Repository.Id, issue.Number); + Assert.Empty(issueLabelsInfo); + + var issueUpdate = new IssueUpdate(); + issueUpdate.AddLabel(label.Name); + var updated = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, issueUpdate); + Assert.NotNull(updated); + + var options = new ApiOptions + { + PageCount = 1, + PageSize = 1 + }; + + issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.Repository.Id, issue.Number, options); + + Assert.Equal(1, issueLabelsInfo.Count); + Assert.Equal(newLabel.Color, issueLabelsInfo[0].Color); + } + [IntegrationTest] public async Task ReturnsCorrectCountOfIssueLabelsWithStartForAnIssue() { @@ -111,6 +163,40 @@ public class IssuesLabelsClientTests : IDisposable Assert.Equal(labels.Last().Color, issueLabelsInfo.First().Color); } + [IntegrationTest] + public async Task ReturnsCorrectCountOfIssueLabelsWithStartForAnIssueWithRepositoryId() + { + var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, new NewIssue("A test issue") { Body = "A new unassigned issue" }); + var issueUpdate = new IssueUpdate(); + + var labels = new List