public void RequestsCorrectUrlWithRepositoryId()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryTrafficClient(gitHubClient);

                client.GetPaths(1);

                gitHubClient.Received().Repository.Traffic.GetPaths(1);
            }
            public void RequestsCorrectUrl()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryTrafficClient(gitHubClient);

                client.GetReferrers("fake", "repo");

                gitHubClient.Received().Repository.Traffic.GetReferrers("fake", "repo");
            }
            public void EnsuresNonNullArguments()
            {
                var client = new ObservableRepositoryTrafficClient(Substitute.For<IGitHubClient>());

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

                Assert.Throws<ArgumentException>(() => client.GetPaths("", "name"));
                Assert.Throws<ArgumentException>(() => client.GetPaths("owner", ""));
            }
        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);
            Traffic      = new ObservableRepositoryTrafficClient(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);
            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);
        }
            public void RequestsCorrectUrl()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryTrafficClient(gitHubClient);
                var per = new RepositoryTrafficRequest(TrafficDayOrWeek.Day);

                client.GetClones("fake", "repo", per);

                gitHubClient.Received().Repository.Traffic.GetClones("fake", "repo", per);
            }
            public void EnsuresNonNullArguments()
            {
                var client = new ObservableRepositoryTrafficClient(Substitute.For<IGitHubClient>());
                var per = new RepositoryTrafficRequest(TrafficDayOrWeek.Day);

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

                Assert.Throws<ArgumentException>(() => client.GetViews("", "name", per));
                Assert.Throws<ArgumentException>(() => client.GetViews("owner", "", per));

                Assert.Throws<ArgumentNullException>(() => client.GetViews(1, null));
            }
            public void RequestsCorrectUrlWithRepositoryId()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoryTrafficClient(gitHubClient);
                var per = new RepositoryTrafficRequest(TrafficDayOrWeek.Day);

                client.GetViews(1, per);

                gitHubClient.Received().Repository.Traffic.GetViews(1, per);
            }