Example #1
0
        /// <summary>
        /// Add admin enforcement to protected branch
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/v3/repos/branches/#add-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 <EnforceAdmins> AddAdminEnforcement(string owner, string name, string branch)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNullOrEmptyString(branch, "branch");

            return(_client.AddAdminEnforcement(owner, name, branch).ToObservable());
        }
        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);
        }