コード例 #1
0
        /// <summary>
        /// Remove admin enforcement on protected branch
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/v3/repos/branches/#remove-admin-enforcement-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 <bool> RemoveAdminEnforcement(string owner, string name, string branch)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNullOrEmptyString(branch, "branch");

            return(_client.RemoveAdminEnforcement(owner, name, branch).ToObservable());
        }
コード例 #2
0
        public async Task AddsAdminEnforcement()
        {
            var repoOwner = _userRepoContext.RepositoryOwner;
            var repoName  = _userRepoContext.RepositoryName;

            await _client.RemoveAdminEnforcement(repoOwner, repoName, "master");

            var enforceAdmins = await _client.AddAdminEnforcement(repoOwner, repoName, "master");

            Assert.NotNull(enforceAdmins);
            Assert.True(enforceAdmins.Enabled);
        }
コード例 #3
0
        public async Task RemovesAdminEnforcement()
        {
            using (var context = await _github.CreateRepositoryWithProtectedBranch())
            {
                var repoOwner = context.RepositoryOwner;
                var repoName  = context.RepositoryName;
                var deleted   = await _client.RemoveAdminEnforcement(repoOwner, repoName, "master");

                Assert.True(deleted);

                var enforceAdmins = await _client.GetAdminEnforcement(repoOwner, repoName, "master");

                Assert.NotNull(enforceAdmins);
                Assert.False(enforceAdmins.Enabled);
            }
        }