Example #1
0
        /// <summary>
        /// Get the required status checks for the specified branch
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/v3/repos/branches/#get-required-status-checks-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>
        public IObservable <BranchProtectionRequiredStatusChecks> GetRequiredStatusChecks(string owner, string name, string branch)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNullOrEmptyString(branch, "branch");

            return(_client.GetRequiredStatusChecks(owner, name, branch).ToObservable());
        }
        public async Task GetsRequiredStatusChecks()
        {
            var repoOwner            = _userRepoContext.RepositoryOwner;
            var repoName             = _userRepoContext.RepositoryName;
            var requiredStatusChecks = await _client.GetRequiredStatusChecks(repoOwner, repoName, "master");

            Assert.NotNull(requiredStatusChecks);
            Assert.NotNull(requiredStatusChecks.Contexts);
            Assert.True(requiredStatusChecks.Strict);
            Assert.Equal(2, requiredStatusChecks.Contexts.Count);
        }