added ClearLabels helper function

This commit is contained in:
Brendan Forster
2015-02-24 13:02:24 +09:30
parent 6c7f0bd56c
commit 6bfd6fdcc1
2 changed files with 42 additions and 0 deletions

View File

@@ -322,6 +322,35 @@ public class IssuesClientTests : IDisposable
Assert.Equal("another thing", updatedIssue.Labels[0].Name);
}
[IntegrationTest]
public async Task CanClearLabelsForAnIssue()
{
var owner = _repository.Owner.Login;
// create some labels
await _issuesClient.Labels.Create(owner, _repository.Name, new NewLabel("something", "FF0000"));
await _issuesClient.Labels.Create(owner, _repository.Name, new NewLabel("another thing", "0000FF"));
// setup us the issue
var newIssue = new NewIssue("A test issue1")
{
Body = "A new unassigned issue",
};
newIssue.Labels.Add("something");
newIssue.Labels.Add("another thing");
var issue = await _issuesClient.Create(owner, _repository.Name, newIssue);
Assert.Equal(2, issue.Labels.Count);
// update the issue
var issueUpdate = issue.ToUpdate();
issueUpdate.ClearLabels();
var updatedIssue = await _issuesClient.Update(owner, _repository.Name, issue.Number, issueUpdate);
Assert.Empty(updatedIssue.Labels);
}
public void Dispose()
{
Helper.DeleteRepo(_repository);