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