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