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); #pragma warning disable CS0618 // Type or member is obsolete RepoCollaborators = new ObservableRepoCollaboratorsClient(client); #pragma warning restore CS0618 // Type or member is obsolete Collaborator = new ObservableRepoCollaboratorsClient(client); Deployment = new ObservableDeploymentsClient(client); Statistics = new ObservableStatisticsClient(client); PullRequest = new ObservablePullRequestsClient(client); #pragma warning disable CS0618 // Type or member is obsolete RepositoryComments = new ObservableRepositoryCommentsClient(client); #pragma warning restore CS0618 // Type or member is obsolete Comment = new ObservableRepositoryCommentsClient(client); #pragma warning disable CS0618 // Type or member is obsolete Commits = new ObservableRepositoryCommitsClient(client); #pragma warning restore CS0618 // Type or member is obsolete Commit = new ObservableRepositoryCommitsClient(client); Release = new ObservableReleasesClient(client); DeployKeys = new ObservableRepositoryDeployKeysClient(client); Content = new ObservableRepositoryContentsClient(client); Merging = new ObservableMergingClient(client); Page = new ObservableRepositoryPagesClient(client); }
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); #pragma warning disable CS0618 // Type or member is obsolete RepoCollaborators = new ObservableRepoCollaboratorsClient(client); #pragma warning restore CS0618 // Type or member is obsolete Collaborator = new ObservableRepoCollaboratorsClient(client); Deployment = new ObservableDeploymentsClient(client); Statistics = new ObservableStatisticsClient(client); PullRequest = new ObservablePullRequestsClient(client); #pragma warning disable CS0618 // Type or member is obsolete RepositoryComments = new ObservableRepositoryCommentsClient(client); #pragma warning restore CS0618 // Type or member is obsolete Comment = new ObservableRepositoryCommentsClient(client); #pragma warning disable CS0618 // Type or member is obsolete Commits = new ObservableRepositoryCommitsClient(client); #pragma warning restore CS0618 // Type or member is obsolete Commit = new ObservableRepositoryCommitsClient(client); Release = new ObservableReleasesClient(client); DeployKeys = new ObservableRepositoryDeployKeysClient(client); Content = new ObservableRepositoryContentsClient(client); Merging = new ObservableMergingClient(client); Page = new ObservableRepositoryPagesClient(client); }
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 RequestsCorrectUrl() { var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); client.GetAllForCommit("fake", "repo", "sha1"); githubClient.Received().Repository.Comment.GetAllForCommit("fake", "repo", "sha1", Args.ApiOptions); }
public void RequestsCorrectUrl() { var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); client.GetAllForRepository("fake", "repo"); githubClient.Connection.Received(1).Get<List<CommitComment>>(Arg.Is<Uri>(uri => uri.ToString() == "repos/fake/repo/comments"), Args.EmptyDictionary, "application/vnd.github.squirrel-girl-preview"); }
public void RequestsCorrectUrlWithRepositoryId() { var gitHub = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(gitHub); client.Get(1, 42); gitHub.Received().Repository.Comment.Get(1, 42); }
public void RequestsCorrectUrlWithRepositoryId() { var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); client.GetAllForRepository(1); githubClient.Connection.Received(1).Get<List<CommitComment>>(Arg.Is<Uri>(uri => uri.ToString() == "repositories/1/comments"), Args.EmptyDictionary, null); }
public void RequestsCorrectUrl() { var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); client.GetAllForRepository("fake", "repo"); githubClient.Connection.Received(1).Get<List<CommitComment>>(Arg.Is<Uri>(uri => uri.ToString() == "repos/fake/repo/comments"), Arg.Is<Dictionary<string, string>>(dictionary => dictionary.Count == 0), null); }
public void EnsuresNonNullArguments() { var client = new ObservableRepositoryCommentsClient(Substitute.For<IGitHubClient>()); Assert.Throws<ArgumentNullException>(() => client.Get(null, "name", 1)); Assert.Throws<ArgumentNullException>(() => client.Get("owner", null, 1)); Assert.Throws<ArgumentException>(() => client.Get("", "name", 1)); Assert.Throws<ArgumentException>(() => client.Get("owner", "", 1)); }
public ObservableRepositoriesClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); _client = client.Repository; _connection = client.Connection; CommitStatus = new ObservableCommitStatusClient(client); RepoCollaborators = new ObservableRepoCollaboratorsClient(client); Deployment = new ObservableDeploymentsClient(client); Statistics = new ObservableStatisticsClient(client); PullRequest = new ObservablePullRequestsClient(client); RepositoryComments = new ObservableRepositoryCommentsClient(client); }
public ObservableRepositoriesClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); _client = client.Repository; _connection = client.Connection; CommitStatus = new ObservableCommitStatusClient(client); RepoCollaborators = new ObservableRepoCollaboratorsClient(client); Deployment = new ObservableDeploymentsClient(client); Statistics = new ObservableStatisticsClient(client); PullRequest = new ObservablePullRequestsClient(client); RepositoryComments = new ObservableRepositoryCommentsClient(client); Commits = new ObservableRepositoryCommitsClient(client); }
public void RequestsCorrectUrlWithApiOptions() { var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); var options = new ApiOptions { StartPage = 1, PageCount = 1, PageSize = 1 }; client.GetAllForRepository("fake", "repo", options); githubClient.Connection.Received(1).Get<List<CommitComment>>(Arg.Is<Uri>(uri => uri.ToString() == "repos/fake/repo/comments"), Arg.Is<Dictionary<string, string>>(dictionary => dictionary.Count == 2), "application/vnd.github.squirrel-girl-preview"); }
public void EnsuresArgumentsNotNull() { var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); Assert.Throws<ArgumentNullException>(() => client.GetAllForRepository(null, null, null)); Assert.Throws<ArgumentNullException>(() => client.GetAllForRepository(null, null, ApiOptions.None)); Assert.Throws<ArgumentNullException>(() => client.GetAllForRepository(null, "name", null)); Assert.Throws<ArgumentNullException>(() => client.GetAllForRepository("owner", null, null)); Assert.Throws<ArgumentNullException>(() => client.GetAllForRepository("owner", "name", null)); Assert.Throws<ArgumentNullException>(() => client.GetAllForRepository("owner", null, ApiOptions.None)); Assert.Throws<ArgumentNullException>(() => client.GetAllForRepository(null, "name", ApiOptions.None)); Assert.Throws<ArgumentNullException>(() => client.GetAllForRepository(null, "name")); Assert.Throws<ArgumentNullException>(() => client.GetAllForRepository("owner", null)); Assert.Throws<ArgumentException>(() => client.GetAllForRepository("", "name")); Assert.Throws<ArgumentException>(() => client.GetAllForRepository("owner", "")); Assert.Throws<ArgumentException>(() => client.GetAllForRepository("", "name", ApiOptions.None)); Assert.Throws<ArgumentException>(() => client.GetAllForRepository("owner", "", ApiOptions.None)); }
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); 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 RequestsCorrectUrlWithRepositoryIdWithApiOptions() { var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); var options = new ApiOptions { StartPage = 1, PageCount = 1, PageSize = 1 }; client.GetAllForCommit(1, "sha", options); githubClient.Connection.Received().Get<List<CommitComment>>(Arg.Is(new Uri("repositories/1/commits/sha/comments", UriKind.Relative)), Arg.Is<IDictionary<string, string>>(d => d.Count == 2), null); }
public void RequestsCorrectUrlWithRepositoryIdWithApiOptions() { var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); var options = new ApiOptions { StartPage = 1, PageCount = 1, PageSize = 1 }; client.GetAllForRepository(1, options); githubClient.Connection.Received(1).Get<List<CommitComment>>(Arg.Is<Uri>(uri => uri.ToString() == "repositories/1/comments"), Arg.Is<Dictionary<string, string>>(dictionary => dictionary.Count == 2), null); }
public void RequestsCorrectUrlWithApiOptions() { var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); var options = new ApiOptions { StartPage = 1, PageCount = 1, PageSize = 1 }; client.GetAllForCommit("fake", "repo", "sha1", options); githubClient.Received().Repository.Comment.GetAllForCommit("fake", "repo", "sha1", options); }
public void RequestsCorrectUrl() { var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); client.GetAllForCommit("fake", "repo", "sha"); githubClient.Connection.Received().Get<List<CommitComment>>(Arg.Is(new Uri("repos/fake/repo/commits/sha/comments", UriKind.Relative)), Args.EmptyDictionary, "application/vnd.github.squirrel-girl-preview"); }
public void EnsuresNonNullArgumentsOrEmpty() { var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); Assert.Throws<ArgumentNullException>(() => client.Delete(null, "name", 42)); Assert.Throws<ArgumentNullException>(() => client.Delete("owner", null, 42)); Assert.Throws<ArgumentException>(() => client.Delete("", "name", 42)); Assert.Throws<ArgumentException>(() => client.Delete("owner", "", 42)); }
public void DeletesCorrectUrlWithRepositoryId() { var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); client.Delete(1, 42); githubClient.Repository.Comment.Received().Delete(1, 42); }
public void RequestsCorrectUrlWithApiOptions() { var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); var options = new ApiOptions { StartPage = 1, PageCount = 1, PageSize = 1 }; client.GetAllForCommit("fake", "repo", "sha", options); githubClient.Connection.Received().Get<List<CommitComment>>(Arg.Is(new Uri("repos/fake/repo/commits/sha/comments", UriKind.Relative)), Arg.Is<IDictionary<string, string>>(d => d.Count == 2), "application/vnd.github.squirrel-girl-preview"); }
public void PostsToCorrectUrlWithRepositoryId() { const string issueCommentUpdate = "updated comment"; var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); client.Update(1, 42, issueCommentUpdate); githubClient.Repository.Comment.Received().Update(1, 42, issueCommentUpdate); }
public void PostsToCorrectUrlWithRepositoryId() { var newComment = new NewCommitComment("body"); var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); client.Create(1, "sha", newComment); githubClient.Repository.Comment.Received().Create(1, "sha", newComment); }
public void RequestsCorrectUrlWithRepositoryId() { var githubClient = Substitute.For<IGitHubClient>(); var client = new ObservableRepositoryCommentsClient(githubClient); client.GetAllForCommit(1, "sha"); githubClient.Connection.Received().Get<List<CommitComment>>(Arg.Is(new Uri("repositories/1/commits/sha/comments", UriKind.Relative)), Args.EmptyDictionary, null); }