public async Task EnsuresNonNullArguments() { var client = new ObservableRepositoryBranchesClient(Substitute.For<IGitHubClient>()); var teamsToRemove = new BranchProtectionTeamCollection() { "test" }; Assert.Throws<ArgumentNullException>(() => client.DeleteProtectedBranchTeamRestrictions(null, "repo", "branch", teamsToRemove)); Assert.Throws<ArgumentNullException>(() => client.DeleteProtectedBranchTeamRestrictions("owner", null, "branch", teamsToRemove)); Assert.Throws<ArgumentNullException>(() => client.DeleteProtectedBranchTeamRestrictions("owner", "repo", null, teamsToRemove)); Assert.Throws<ArgumentNullException>(() => client.DeleteProtectedBranchTeamRestrictions("owner", "repo", "branch", null)); Assert.Throws<ArgumentNullException>(() => client.DeleteProtectedBranchTeamRestrictions(1, null, teamsToRemove)); Assert.Throws<ArgumentNullException>(() => client.DeleteProtectedBranchTeamRestrictions(1, "branch", null)); Assert.Throws<ArgumentException>(() => client.DeleteProtectedBranchTeamRestrictions("", "repo", "branch", teamsToRemove)); Assert.Throws<ArgumentException>(() => client.DeleteProtectedBranchTeamRestrictions("owner", "", "branch", teamsToRemove)); Assert.Throws<ArgumentException>(() => client.DeleteProtectedBranchTeamRestrictions("owner", "repo", "", teamsToRemove)); Assert.Throws<ArgumentException>(() => client.DeleteProtectedBranchTeamRestrictions(1, "", teamsToRemove)); }
public void RequestsTheCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryBranchesClient(gitHubClient); var teamsToRemove = new BranchProtectionTeamCollection() { "test" }; client.DeleteProtectedBranchTeamRestrictions(1, "branch", teamsToRemove); gitHubClient.Repository.Branch.Received() .DeleteProtectedBranchTeamRestrictions(1, "branch", teamsToRemove); }