public IObservable <Branch> Get(string owner, string name, string branch) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(branch, "branch"); return(_client.Get(owner, name, branch).ToObservable()); }
public async Task ProtectsBranch() { // Set master branch to be protected, with some status checks var requiredStatusChecks = new RequiredStatusChecks(EnforcementLevel.Everyone, new List <string> { "check1", "check2", "check3" }); var update = new BranchUpdate(); update.Protection = new BranchProtection(true, requiredStatusChecks); var branch = await _fixture.Edit(_context.Repository.Owner.Login, _context.Repository.Name, "master", update); // Ensure a branch object was returned Assert.NotNull(branch); // Retrieve master branch branch = await _fixture.Get(_context.Repository.Owner.Login, _context.Repository.Name, "master"); // Assert the changes were made Assert.Equal(branch.Protection.Enabled, true); Assert.Equal(branch.Protection.RequiredStatusChecks.EnforcementLevel, EnforcementLevel.Everyone); Assert.Equal(branch.Protection.RequiredStatusChecks.Contexts.Count, 3); }