Ejemplo n.º 1
0
        /// <summary>
        /// Add the required status checks context for the specified branch
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/v3/repos/branches/#add-required-status-checks-contexts-of-protected-branch">API documentation</a> for more details
        /// </remarks>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="branch">The name of the branch</param>
        /// <param name="contexts">The contexts to add</param>
        public IObservable <string> AddRequiredStatusChecksContexts(string owner, string name, string branch, IReadOnlyList <string> contexts)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNullOrEmptyString(branch, "branch");
            Ensure.ArgumentNotNull(contexts, "contexts");

            return(_client.AddRequiredStatusChecksContexts(owner, name, branch, contexts).ToObservable().SelectMany(x => x));
        }
        public async Task AddsRequiredStatusChecksContexts()
        {
            var repoOwner = _userRepoContext.RepositoryOwner;
            var repoName  = _userRepoContext.RepositoryName;
            var update    = new List <string>()
            {
                "build2", "deploy"
            };
            var requiredStatusChecksContexts = await _client.AddRequiredStatusChecksContexts(repoOwner, repoName, "master", update);

            Assert.NotNull(requiredStatusChecksContexts);
            Assert.NotNull(requiredStatusChecksContexts.Count);
            Assert.Equal(4, requiredStatusChecksContexts.Count);
        }