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