public ObservableRepositoriesClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, nameof(client)); _client = client.Repository; _connection = client.Connection; Status = new ObservableCommitStatusClient(client); Hooks = new ObservableRepositoryHooksClient(client); Forks = new ObservableRepositoryForksClient(client); Collaborator = new ObservableRepoCollaboratorsClient(client); Deployment = new ObservableDeploymentsClient(client); Statistics = new ObservableStatisticsClient(client); PullRequest = new ObservablePullRequestsClient(client); Branch = new ObservableRepositoryBranchesClient(client); Comment = new ObservableRepositoryCommentsClient(client); Commit = new ObservableRepositoryCommitsClient(client); Release = new ObservableReleasesClient(client); DeployKeys = new ObservableRepositoryDeployKeysClient(client); Content = new ObservableRepositoryContentsClient(client); Merging = new ObservableMergingClient(client); Page = new ObservableRepositoryPagesClient(client); Invitation = new ObservableRepositoryInvitationsClient(client); Traffic = new ObservableRepositoryTrafficClient(client); Project = new ObservableProjectsClient(client); }
public void RequestsTheCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryBranchesClient(gitHubClient); var expected = new Uri("repositories/1/branches", UriKind.Relative); client.GetAll(1); gitHubClient.Connection.Received(1).Get<List<Branch>>(expected, Args.EmptyDictionary, null); }
public void RequestsTheCorrectUrlWithRepositoryIdWithApiOptions() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryBranchesClient(gitHubClient); var expected = new Uri("repositories/1/branches", UriKind.Relative); var options = new ApiOptions { PageCount = 1, StartPage = 1, PageSize = 1 }; client.GetAll(1, options); gitHubClient.Connection.Received(1).Get<List<Branch>>(expected, Arg.Is<IDictionary<string, string>>(d => d.Count == 2 && d["page"] == "1" && d["per_page"] == "1"), null); }
public ObservableRepositoriesClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); _client = client.Repository; _connection = client.Connection; Status = new ObservableCommitStatusClient(client); Hooks = new ObservableRepositoryHooksClient(client); Forks = new ObservableRepositoryForksClient(client); Collaborator = new ObservableRepoCollaboratorsClient(client); Deployment = new ObservableDeploymentsClient(client); Statistics = new ObservableStatisticsClient(client); PullRequest = new ObservablePullRequestsClient(client); Branch = new ObservableRepositoryBranchesClient(client); Comment = new ObservableRepositoryCommentsClient(client); Commit = new ObservableRepositoryCommitsClient(client); Release = new ObservableReleasesClient(client); DeployKeys = new ObservableRepositoryDeployKeysClient(client); Content = new ObservableRepositoryContentsClient(client); Merging = new ObservableMergingClient(client); Page = new ObservableRepositoryPagesClient(client); Invitation = new ObservableRepositoryInvitationsClient(client); }
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); }
public void RequestsTheCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryBranchesClient(gitHubClient); var newTeams = new BranchProtectionTeamCollection() { "test" }; client.AddProtectedBranchTeamRestrictions("owner", "repo", "branch", newTeams); gitHubClient.Repository.Branch.Received() .AddProtectedBranchTeamRestrictions("owner", "repo", "branch", newTeams); }
public void EnsuresNonNullArguments() { var client = new ObservableRepositoryBranchesClient(Substitute.For<IGitHubClient>()); Assert.Throws<ArgumentNullException>(() => client.GetAll(null, "name")); Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", null)); Assert.Throws<ArgumentNullException>(() => client.GetAll(null, "name", ApiOptions.None)); Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", null, ApiOptions.None)); Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", "name", null)); Assert.Throws<ArgumentNullException>(() => client.GetAll(1, null)); Assert.Throws<ArgumentException>(() => client.GetAll("", "name")); Assert.Throws<ArgumentException>(() => client.GetAll("owner", "")); Assert.Throws<ArgumentException>(() => client.GetAll("", "name", ApiOptions.None)); Assert.Throws<ArgumentException>(() => client.GetAll("owner", "", ApiOptions.None)); }
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); }
public void RequestsTheCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryBranchesClient(gitHubClient); client.DeleteProtectedBranchRestrictions("owner", "repo", "branch"); gitHubClient.Repository.Branch.Received() .DeleteProtectedBranchRestrictions("owner", "repo", "branch"); }
public async Task EnsuresNonNullArguments() { var client = new ObservableRepositoryBranchesClient(Substitute.For<IGitHubClient>()); Assert.Throws<ArgumentNullException>(() => client.GetProtectedBranchUserRestrictions(null, "repo", "branch")); Assert.Throws<ArgumentNullException>(() => client.GetProtectedBranchUserRestrictions("owner", null, "branch")); Assert.Throws<ArgumentNullException>(() => client.GetProtectedBranchUserRestrictions("owner", "repo", null)); Assert.Throws<ArgumentNullException>(() => client.GetProtectedBranchUserRestrictions(1, null)); Assert.Throws<ArgumentException>(() => client.GetProtectedBranchUserRestrictions("", "repo", "branch")); Assert.Throws<ArgumentException>(() => client.GetProtectedBranchUserRestrictions("owner", "", "branch")); Assert.Throws<ArgumentException>(() => client.GetProtectedBranchUserRestrictions("owner", "repo", "")); Assert.Throws<ArgumentException>(() => client.GetProtectedBranchUserRestrictions(1, "")); }
public void RequestsTheCorrectUrlWithRepositoryId() { var github = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryBranchesClient(github); var update = new BranchUpdate(); client.Edit(1, "branch", update); github.Repository.Branch.Received(1).Edit(1, "branch", update); }
public async Task EnsuresNonNullArguments() { var client = new ObservableRepositoryBranchesClient(Substitute.For<IGitHubClient>()); Assert.Throws<ArgumentNullException>(() => client.GetRequiredStatusChecksContexts(null, "repo", "branch")); Assert.Throws<ArgumentNullException>(() => client.GetRequiredStatusChecksContexts("owner", null, "branch")); Assert.Throws<ArgumentNullException>(() => client.GetRequiredStatusChecksContexts("owner", "repo", null)); Assert.Throws<ArgumentNullException>(() => client.GetRequiredStatusChecksContexts(1, null)); Assert.Throws<ArgumentException>(() => client.GetRequiredStatusChecksContexts("", "repo", "branch")); Assert.Throws<ArgumentException>(() => client.GetRequiredStatusChecksContexts("owner", "", "branch")); Assert.Throws<ArgumentException>(() => client.GetRequiredStatusChecksContexts("owner", "repo", "")); Assert.Throws<ArgumentException>(() => client.GetRequiredStatusChecksContexts(1, "")); }
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 async Task EnsuresNonNullArguments() { var client = new ObservableRepositoryBranchesClient(Substitute.For<IGitHubClient>()); var update = new BranchProtectionRequiredStatusChecksUpdate(true, true, new[] { "test" }); Assert.Throws<ArgumentNullException>(() => client.UpdateRequiredStatusChecks(null, "repo", "branch", update)); Assert.Throws<ArgumentNullException>(() => client.UpdateRequiredStatusChecks("owner", null, "branch", update)); Assert.Throws<ArgumentNullException>(() => client.UpdateRequiredStatusChecks("owner", "repo", null, update)); Assert.Throws<ArgumentNullException>(() => client.UpdateRequiredStatusChecks("owner", "repo", "branch", null)); Assert.Throws<ArgumentNullException>(() => client.UpdateRequiredStatusChecks(1, null, update)); Assert.Throws<ArgumentNullException>(() => client.UpdateRequiredStatusChecks(1, "branch", null)); Assert.Throws<ArgumentException>(() => client.UpdateRequiredStatusChecks("", "repo", "branch", update)); Assert.Throws<ArgumentException>(() => client.UpdateRequiredStatusChecks("owner", "", "branch", update)); Assert.Throws<ArgumentException>(() => client.UpdateRequiredStatusChecks("owner", "repo", "", update)); Assert.Throws<ArgumentException>(() => client.UpdateRequiredStatusChecks(1, "", update)); }
public void RequestsTheCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryBranchesClient(gitHubClient); client.GetRequiredStatusChecksContexts(1, "branch"); gitHubClient.Repository.Branch.Received() .GetRequiredStatusChecksContexts(1, "branch"); }
public void RequestsTheCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryBranchesClient(gitHubClient); var update = new BranchProtectionRequiredStatusChecksUpdate(true, true, new[] { "test" }); client.UpdateRequiredStatusChecks(1, "branch", update); gitHubClient.Repository.Branch.Received() .UpdateRequiredStatusChecks(1, "branch", update); }
public void RequestsTheCorrectUrl() { var github = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryBranchesClient(github); client.Get("owner", "repo", "branch"); github.Repository.Branch.Received(1).Get("owner", "repo", "branch"); }
public async Task EnsuresNonNullArguments() { var client = new ObservableRepositoryBranchesClient(Substitute.For<IGitHubClient>()); var update = new BranchUpdate(); Assert.Throws<ArgumentNullException>(() => client.Edit(null, "repo", "branch", update)); Assert.Throws<ArgumentNullException>(() => client.Edit("owner", null, "branch", update)); Assert.Throws<ArgumentNullException>(() => client.Edit("owner", "repo", null, update)); Assert.Throws<ArgumentNullException>(() => client.Edit("owner", "repo", "branch", null)); Assert.Throws<ArgumentNullException>(() => client.Edit(1, null, update)); Assert.Throws<ArgumentNullException>(() => client.Edit(1, "branch", null)); Assert.Throws<ArgumentException>(() => client.Edit("", "repo", "branch", update)); Assert.Throws<ArgumentException>(() => client.Edit("owner", "", "branch", update)); Assert.Throws<ArgumentException>(() => client.Edit("owner", "repo", "", update)); Assert.Throws<ArgumentException>(() => client.Edit(1, "", update)); }
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 contextsToRemove = new List<string>() { "test" }; client.DeleteRequiredStatusChecksContexts(1, "branch", contextsToRemove); gitHubClient.Repository.Branch.Received() .DeleteRequiredStatusChecksContexts(1, "branch", contextsToRemove); }
public void RequestsTheCorrectUrlWithRepositoryId() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryBranchesClient(gitHubClient); client.GetProtectedBranchUserRestrictions(1, "branch"); gitHubClient.Repository.Branch.Received() .GetProtectedBranchUserRestrictions(1, "branch"); }
public async Task EnsuresNonNullArguments() { var client = new ObservableRepositoryBranchesClient(Substitute.For<IGitHubClient>()); var contextsToRemove = new List<string>() { "test" }; Assert.Throws<ArgumentNullException>(() => client.DeleteRequiredStatusChecksContexts(null, "repo", "branch", contextsToRemove)); Assert.Throws<ArgumentNullException>(() => client.DeleteRequiredStatusChecksContexts("owner", null, "branch", contextsToRemove)); Assert.Throws<ArgumentNullException>(() => client.DeleteRequiredStatusChecksContexts("owner", "repo", null, contextsToRemove)); Assert.Throws<ArgumentNullException>(() => client.DeleteRequiredStatusChecksContexts("owner", "repo", "branch", null)); Assert.Throws<ArgumentNullException>(() => client.DeleteRequiredStatusChecksContexts(1, null, contextsToRemove)); Assert.Throws<ArgumentNullException>(() => client.DeleteRequiredStatusChecksContexts(1, "branch", null)); Assert.Throws<ArgumentException>(() => client.DeleteRequiredStatusChecksContexts("", "repo", "branch", contextsToRemove)); Assert.Throws<ArgumentException>(() => client.DeleteRequiredStatusChecksContexts("owner", "", "branch", contextsToRemove)); Assert.Throws<ArgumentException>(() => client.DeleteRequiredStatusChecksContexts("owner", "repo", "", contextsToRemove)); Assert.Throws<ArgumentException>(() => client.DeleteRequiredStatusChecksContexts(1, "", contextsToRemove)); }
public void RequestsTheCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryBranchesClient(gitHubClient); var newContexts = new List<string>() { "test" }; client.AddRequiredStatusChecksContexts("owner", "repo", "branch", newContexts); gitHubClient.Repository.Branch.Received() .AddRequiredStatusChecksContexts("owner", "repo", "branch", newContexts); }
public void RequestsTheCorrectUrl() { var gitHubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryBranchesClient(gitHubClient); var usersToRemove = new BranchProtectionUserCollection() { "test" }; client.DeleteProtectedBranchUserRestrictions("owner", "repo", "branch", usersToRemove); gitHubClient.Repository.Branch.Received() .DeleteProtectedBranchUserRestrictions("owner", "repo", "branch", usersToRemove); }