/// <summary>
        /// Locks an issue for the specified repository. Issue owners and users with push access can lock an issue.
        /// </summary>
        /// <remarks>https://developer.github.com/v3/issues/#lock-an-issue</remarks>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="number">The issue number</param>
        public IObservable <Unit> Lock(string owner, string name, int number)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");

            return(_client.Lock(owner, name, number).ToObservable());
        }
    public async Task CanLockAndUnlockIssue()
    {
        var newIssue = new NewIssue("a test issue")
        {
            Body = "A new unassigned issue"
        };
        var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);

        Assert.False(issue.Locked);

        await _issuesClient.Lock(_context.RepositoryOwner, _context.RepositoryName, issue.Number);

        var retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);

        Assert.NotNull(retrieved);
        Assert.True(retrieved.Locked);

        await _issuesClient.Unlock(_context.RepositoryOwner, _context.RepositoryName, issue.Number);

        retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);

        Assert.NotNull(retrieved);
        Assert.False(retrieved.Locked);
    }
Exemplo n.º 3
0
    public async Task ReturnsCorrectCountOfEventInfosWithoutStart()
    {
        var newIssue = new NewIssue("issue 1")
        {
            Body = "A new unassigned issue"
        };
        var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);

        await _issuesClient.Lock(_context.RepositoryOwner, _context.RepositoryName, issue.Number);

        await _issuesClient.Unlock(_context.RepositoryOwner, _context.RepositoryName, issue.Number);

        await _issuesClient.Lock(_context.RepositoryOwner, _context.RepositoryName, issue.Number);

        var options = new ApiOptions
        {
            PageSize  = 3,
            PageCount = 1
        };

        var eventInfos = await _issuesEventsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, options);

        Assert.Equal(3, eventInfos.Count);
    }