mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-06 20:13:40 +00:00
take care of initializing the labels array as late as possible
This commit is contained in:
@@ -41,7 +41,7 @@ public class IssuesLabelsClientTests : IDisposable
|
||||
Assert.Empty(issueLabelsInfo);
|
||||
|
||||
var issueUpdate = new IssueUpdate();
|
||||
issueUpdate.Labels.Add(label.Name);
|
||||
issueUpdate.AddLabel(label.Name);
|
||||
var updated = await _issuesClient.Update(_repositoryOwner, _repository.Name, issue.Number, issueUpdate);
|
||||
Assert.NotNull(updated);
|
||||
issueLabelsInfo = await _issuesLabelsClient.GetForIssue(_repositoryOwner, _repositoryName, issue.Number);
|
||||
|
||||
@@ -60,5 +60,16 @@ namespace Octokit
|
||||
return String.Format(CultureInfo.InvariantCulture, "Title: {0}",Title);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddLabel(string name)
|
||||
{
|
||||
// lazily create the label array
|
||||
if (Labels == null)
|
||||
{
|
||||
Labels = new List<string>();
|
||||
}
|
||||
|
||||
Labels.Add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user