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