/// <summary> /// Get the branch protection settings for the specified branch /// </summary> /// <remarks> /// See the <a href="https://developer.github.com/v3/repos/branches/#get-branch-protection">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 <BranchProtectionSettings> GetBranchProtection(string owner, string name, string branch) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(branch, "branch"); return(_client.GetBranchProtection(owner, name, branch).ToObservable()); }
public async Task GetsBranchProtection() { var repoOwner = _userRepoContext.RepositoryOwner; var repoName = _userRepoContext.RepositoryName; var protection = await _client.GetBranchProtection(repoOwner, repoName, "master"); Assert.True(protection.RequiredStatusChecks.IncludeAdmins); Assert.True(protection.RequiredStatusChecks.Strict); Assert.Equal(2, protection.RequiredStatusChecks.Contexts.Count); Assert.Null(protection.Restrictions); }