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);
        }
Exemplo n.º 3
0
        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 EnsuresNonEmptyArguments()
            {
                var client = new ObservableRepositoryCommitsClient(Substitute.For<IGitHubClient>());

                Assert.ThrowsAsync<ArgumentException>(() => client.GetSha1("", "name", "reference").ToTask());
                Assert.ThrowsAsync<ArgumentException>(() => client.GetSha1("owner", "", "reference").ToTask());
                Assert.ThrowsAsync<ArgumentException>(() => client.GetSha1("owner", "name", "").ToTask());
            }
            public async Task EnsuresNonNullArguments()
            {
                var client = new ObservableRepositoryCommitsClient(Substitute.For<IGitHubClient>());

                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetSha1(null, "name", "reference").ToTask());
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetSha1("owner", null, "reference").ToTask());
                await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetSha1("owner", "name", null).ToTask());
            }
            public void RequestsCorrectUrlWithRepositoryId()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryCommitsClient(gitHubClient);

                client.Compare(1, "base", "head");

                gitHubClient.Received().Repository.Commit.Compare(1, "base", "head");
            }
            public void RequestsCorrectUrlWithRepositoryId()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryCommitsClient(gitHubClient);

                client.Get(1, "reference");

                gitHubClient.Received().Repository.Commit.Get(1, "reference");
            }
            public void EnsuresNonEmptyArguments()
            {
                var githubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryCommitsClient(githubClient);
                var options = new ApiOptions();
                var request = new CommitRequest();

                Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("", "name", request, options).ToTask());
                Assert.ThrowsAsync<ArgumentException>(() => client.GetAll("owner", "", request, options).ToTask());
            }
            public void GetsCorrectUrl()
            {
                var githubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryCommitsClient(githubClient);
                var options = new ApiOptions();
                var request = new CommitRequest();

                client.GetAll("fake", "repo", request, options);
                githubClient.Received().Repository.Commit.GetAll("fake", "repo", request, options);
            }
 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 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 EnsuresNonNullArguments()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryCommitsClient(gitHubClient);

                Assert.Throws<ArgumentNullException>(() => client.Compare(null, "name", "base", "head"));
                Assert.Throws<ArgumentNullException>(() => client.Compare("owner", null, "base", "head"));
                Assert.Throws<ArgumentNullException>(() => client.Compare("owner", "name", null, "head"));
                Assert.Throws<ArgumentNullException>(() => client.Compare("owner", "name", "base", null));

                Assert.Throws<ArgumentNullException>(() => client.Compare(1, null, "head"));
                Assert.Throws<ArgumentNullException>(() => client.Compare(1, "base", null));

                Assert.Throws<ArgumentException>(() => client.Compare("", "name", "base", "head"));
                Assert.Throws<ArgumentException>(() => client.Compare("owner", "", "base", "head"));
                Assert.Throws<ArgumentException>(() => client.Compare("owner", "name", "", "head"));
                Assert.Throws<ArgumentException>(() => client.Compare("owner", "name", "base", ""));
                Assert.Throws<ArgumentException>(() => client.Compare(1, "", "head"));
                Assert.Throws<ArgumentException>(() => client.Compare(1, "base", ""));
            }
        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 ObservableRepositoryCommitsClient(gitHubClient);

                var options = new ApiOptions
                {
                    PageCount = 1,
                    StartPage = 1,
                    PageSize = 1
                };

                client.GetAll(1, options);

                gitHubClient.Received().Repository.Commit.GetAll(1, options);
            }
            public void RequestsCorrectUrlWithRepositoryIdParameterized()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryCommitsClient(gitHubClient);

                var commitRequest = new CommitRequest
                {
                    Author = "author",
                    Sha = "sha",
                    Path = "path",
                    Since = null,
                    Until = null
                };

                client.GetAll(1, commitRequest);

                gitHubClient.Received().Repository.Commit.GetAll(1, commitRequest);
            }
            public void GetsCorrectUrl()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryCommitsClient(gitHubClient);

                client.GetSha1("owner", "name", "reference");

                gitHubClient
                    .Received()
                    .Repository
                    .Commit
                    .GetSha1("owner", "name", "reference");
            }
            public void RequestsCorrectUrlWithRepositoryIdWithApiOptionsParameterized()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryCommitsClient(gitHubClient);

                var commitRequest = new CommitRequest
                {
                    Author = "author",
                    Sha = "sha",
                    Path = "path",
                    Since = null,
                    Until = null
                };

                var options = new ApiOptions
                {
                    PageCount = 1,
                    StartPage = 1,
                    PageSize = 1
                };

                client.GetAll(1, commitRequest, options);

                gitHubClient.Received().Repository.Commit.GetAll(1, commitRequest, options);
            }
            public void EnsuresNonNullArguments()
            {
                var connection = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryCommitsClient(connection);

                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", (ApiOptions)null));

                Assert.Throws<ArgumentNullException>(() => client.GetAll(null, "name", new CommitRequest()));
                Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", null, new CommitRequest()));
                Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", "name", (CommitRequest)null));

                Assert.Throws<ArgumentNullException>(() => client.GetAll(null, "name", new CommitRequest(), ApiOptions.None));
                Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", null, new CommitRequest(), ApiOptions.None));
                Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", "name", null, ApiOptions.None));
                Assert.Throws<ArgumentNullException>(() => client.GetAll("owner", "name", new CommitRequest(), null));

                Assert.Throws<ArgumentNullException>(() => client.GetAll(1, (ApiOptions)null));
                Assert.Throws<ArgumentNullException>(() => client.GetAll(1, (CommitRequest)null));
                Assert.Throws<ArgumentNullException>(() => client.GetAll(1, null, ApiOptions.None));
                Assert.Throws<ArgumentNullException>(() => client.GetAll(1, new CommitRequest(), 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));
                Assert.Throws<ArgumentException>(() => client.GetAll("", "name", new CommitRequest()));
                Assert.Throws<ArgumentException>(() => client.GetAll("owner", "", new CommitRequest()));
                Assert.Throws<ArgumentException>(() => client.GetAll("", "name", new CommitRequest(), ApiOptions.None));
                Assert.Throws<ArgumentException>(() => client.GetAll("owner", "", new CommitRequest(), ApiOptions.None));
            }
            public void RequestsCorrectUrl()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryCommitsClient(gitHubClient);

                client.GetSha1("fake", "repo", "ref");

                gitHubClient.Received().Repository.Commit.GetSha1("fake", "repo", "ref");
            }
            public void EnsuresNonNullArguments()
            {
                var connection = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryCommitsClient(connection);

                Assert.Throws<ArgumentNullException>(() => client.GetSha1(null, "name", "ref"));
                Assert.Throws<ArgumentNullException>(() => client.GetSha1("owner", null, "ref"));
                Assert.Throws<ArgumentNullException>(() => client.GetSha1("owner", "name", null));

                Assert.Throws<ArgumentNullException>(() => client.GetSha1(1, null));

                Assert.Throws<ArgumentException>(() => client.GetSha1("", "name", "ref"));
                Assert.Throws<ArgumentException>(() => client.GetSha1("owner", "", "ref"));
                Assert.Throws<ArgumentException>(() => client.GetSha1("owner", "name", ""));

                Assert.Throws<ArgumentException>(() => client.GetSha1(1, ""));
            }
 public TheGetAllMethod()
 {
     var client = Helper.GetAuthenticatedClient();
     _repositoryCommitsClient = new ObservableRepositoryCommitsClient(client);
 }