Пример #1
0
    public async Task CanListLabelsForAnIssue()
    {
        var newIssue = new NewIssue("A test issue")
        {
            Body = "A new unassigned issue"
        };
        var newLabel = new NewLabel("test label", "FFFFFF");

        var label = await _issuesLabelsClient.Create(_repositoryOwner, _repository.Name, newLabel);

        var issue = await _issuesClient.Create(_repositoryOwner, _repositoryName, newIssue);

        var issueLabelsInfo = await _issuesLabelsClient.GetForIssue(_repositoryOwner, _repositoryName, issue.Number);

        Assert.Empty(issueLabelsInfo);

        var issueUpdate = new IssueUpdate();

        issueUpdate.Labels.Add(label.Name);
        var updated = await _issuesClient.Update(_repositoryOwner, _repository.Name, issue.Number, issueUpdate);

        Assert.NotNull(updated);
        issueLabelsInfo = await _issuesLabelsClient.GetForIssue(_repositoryOwner, _repositoryName, issue.Number);

        Assert.Equal(1, issueLabelsInfo.Count);
        Assert.Equal(newLabel.Color, issueLabelsInfo[0].Color);
    }
Пример #2
0
        /// <summary>
        /// Creates a label.
        /// </summary>
        /// <remarks>
        /// See the <a href="http://developer.github.com/v3/issues/labels/#create-a-label">API documentation</a> for more information.
        /// </remarks>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="newLabel">The data for the label to be created</param>
        public IObservable <Label> Create(string owner, string name, NewLabel newLabel)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
            Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
            Ensure.ArgumentNotNull(newLabel, nameof(newLabel));

            return(_client.Create(owner, name, newLabel).ToObservable());
        }
Пример #3
0
 /// <summary>
 /// Creates a label.
 /// </summary>
 /// <remarks>
 /// See the <a href="http://developer.github.com/v3/issues/labels/#create-a-label">API documentation</a> for more information.
 /// </remarks>
 /// <param name="owner">The owner of the repository</param>
 /// <param name="repo">The name of the repository</param>
 /// <param name="newLabel">The data for the label to be created</param>
 /// <returns>The created label</returns>
 public IObservable <Label> Create(string owner, string repo, NewLabel newLabel)
 {
     return(_client.Create(owner, repo, newLabel).ToObservable());
 }