public async Task RequestsCorrectUrlWithRepositoryId()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(gitHubClient);

                await client.Get(1);

                gitHubClient.Repository.Get(1);
            }
            public async Task RequestsCorrectUrl()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(gitHubClient);

                await client.Get("owner", "name");

                gitHubClient.Received().Repository.Get("owner", "name");
            }
            public async Task EnsuresNonNullArguments()
            {
                var client = new ObservableRepositoriesClient(Substitute.For<IGitHubClient>());

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

                Assert.Throws<ArgumentException>(() => client.Delete("", "name"));
                Assert.Throws<ArgumentException>(() => client.Delete("owner", ""));
            }
            public async Task ReturnsAllPublicReposSinceLastSeen()
            {
                var github = Helper.GetAuthenticatedClient();

                var client = new ObservableRepositoriesClient(github);
                var request = new PublicRepositoryRequest(32732250L);
                var repositories = await client.GetAllPublic(request).ToArray();
                Assert.NotEmpty(repositories);
                Assert.Equal(32732252, repositories[0].Id);
                Assert.False(repositories[0].Private);
                Assert.Equal("zad19", repositories[0].Name);
            }
        public ObservableGitHubClient(IGitHubClient gitHubClient)
        {
            Ensure.ArgumentNotNull(gitHubClient, "githubClient");

            _gitHubClient = gitHubClient;
            Authorization = new ObservableAuthorizationsClient(gitHubClient);
            Miscellaneous = new ObservableMiscellaneousClient(gitHubClient.Miscellaneous);
            Notification = new ObservableNotificationsClient(gitHubClient);
            Organization = new ObservableOrganizationsClient(gitHubClient);
            Repository = new ObservableRepositoriesClient(gitHubClient);
            SshKey = new ObservableSshKeysClient(gitHubClient);
            User = new ObservableUsersClient(gitHubClient);
            Release = new ObservableReleasesClient(gitHubClient);
        }
            public async Task ReturnsSpecifiedRepository()
            {
                var github = Helper.GetAuthenticatedClient();

                var client = new ObservableRepositoriesClient(github);
                var observable = client.Get("haacked", "seegit");
                var repository = await observable;
                var repository2 = await observable;

                Assert.Equal("https://github.com/Haacked/SeeGit.git", repository.CloneUrl);
                Assert.False(repository.Private);
                Assert.False(repository.Fork);
                Assert.Equal("https://github.com/Haacked/SeeGit.git", repository2.CloneUrl);
                Assert.False(repository2.Private);
                Assert.False(repository2.Fork);
            }
            public async Task ReturnsEveryPageOfRepositories()
            {
                var firstPageUrl = new Uri("user/repos", UriKind.Relative);
                var secondPageUrl = new Uri("https://example.com/page/2");
                var firstPageLinks = new Dictionary<string, Uri> { { "next", secondPageUrl } };
                var firstPageResponse = new ApiResponse<List<Repository>>(
                    CreateResponseWithApiInfo(firstPageLinks),
                    new List<Repository>
                    {
                        new Repository(1),
                        new Repository(2),
                        new Repository(3)
                    });
                var thirdPageUrl = new Uri("https://example.com/page/3");
                var secondPageLinks = new Dictionary<string, Uri> { { "next", thirdPageUrl } };
                var secondPageResponse = new ApiResponse<List<Repository>>
                (
                    CreateResponseWithApiInfo(secondPageLinks),
                    new List<Repository>
                    {
                        new Repository(4),
                        new Repository(5),
                        new Repository(6)
                    });
                var lastPageResponse = new ApiResponse<List<Repository>>(
                    new Response(),
                    new List<Repository>
                    {
                        new Repository(7)
                    });
                var gitHubClient = Substitute.For<IGitHubClient>();
                gitHubClient.Connection.GetResponse<List<Repository>>(firstPageUrl)
                    .Returns(Task.Factory.StartNew<IApiResponse<List<Repository>>>(() => firstPageResponse));
                gitHubClient.Connection.GetResponse<List<Repository>>(secondPageUrl)
                    .Returns(Task.Factory.StartNew<IApiResponse<List<Repository>>>(() => secondPageResponse));
                gitHubClient.Connection.GetResponse<List<Repository>>(thirdPageUrl)
                    .Returns(Task.Factory.StartNew<IApiResponse<List<Repository>>>(() => lastPageResponse));
                var repositoriesClient = new ObservableRepositoriesClient(gitHubClient);

                var results = await repositoriesClient.GetAllForCurrent().ToArray();

                Assert.Equal(7, results.Length);
                gitHubClient.Connection.Received(1).Get<List<Repository>>(firstPageUrl, null, null);
                gitHubClient.Connection.Received(1).Get<List<Repository>>(secondPageUrl, null, null);
                gitHubClient.Connection.Received(1).Get<List<Repository>>(thirdPageUrl, null, null);
            }
            public async Task ReturnsSpecifiedRepository()
            {
                var github = new GitHubClient(new ProductHeaderValue("OctokitTests"))
                {
                    Credentials = Helper.Credentials
                };
                var client = new ObservableRepositoriesClient(github);
                var observable = client.Get("haacked", "seegit");
                var repository = await observable;
                var repository2 = await observable;

                Assert.Equal("https://github.com/Haacked/SeeGit.git", repository.CloneUrl);
                Assert.False(repository.Private);
                Assert.False(repository.Fork);
                Assert.Equal("https://github.com/Haacked/SeeGit.git", repository2.CloneUrl);
                Assert.False(repository2.Private);
                Assert.False(repository2.Fork);
            }
예제 #9
0
        public ObservableGitHubClient(IGitHubClient gitHubClient)
        {
            Ensure.ArgumentNotNull(gitHubClient, "githubClient");

            _gitHubClient = gitHubClient;
            Authorization = new ObservableAuthorizationsClient(gitHubClient);
            Activity = new ObservableActivitiesClient(gitHubClient);
            Issue = new ObservableIssuesClient(gitHubClient);
            Miscellaneous = new ObservableMiscellaneousClient(gitHubClient.Miscellaneous);
            Notification = new ObservableNotificationsClient(gitHubClient);
            Organization = new ObservableOrganizationsClient(gitHubClient);
            Repository = new ObservableRepositoriesClient(gitHubClient);
            SshKey = new ObservableSshKeysClient(gitHubClient);
            User = new ObservableUsersClient(gitHubClient);
            Release = new ObservableReleasesClient(gitHubClient);
            GitDatabase = new ObservableGitDatabaseClient(gitHubClient);
            Gist = new ObservableGistsClient(gitHubClient);
            Search = new ObservableSearchClient(gitHubClient);
        }
        public ObservableGitHubClient(IGitHubClient gitHubClient)
        {
            Ensure.ArgumentNotNull(gitHubClient, "githubClient");

            _gitHubClient = gitHubClient;
            Authorization = new ObservableAuthorizationsClient(gitHubClient);
            Activity      = new ObservableActivitiesClient(gitHubClient);
            Issue         = new ObservableIssuesClient(gitHubClient);
            Miscellaneous = new ObservableMiscellaneousClient(gitHubClient.Miscellaneous);
            Notification  = new ObservableNotificationsClient(gitHubClient);
            Organization  = new ObservableOrganizationsClient(gitHubClient);
            Repository    = new ObservableRepositoriesClient(gitHubClient);
            SshKey        = new ObservableSshKeysClient(gitHubClient);
            User          = new ObservableUsersClient(gitHubClient);
            Release       = new ObservableReleasesClient(gitHubClient);
            GitDatabase   = new ObservableGitDatabaseClient(gitHubClient);
            Gist          = new ObservableGistsClient(gitHubClient);
            Search        = new ObservableSearchClient(gitHubClient);
        }
예제 #11
0
        // #LineComplexity: 1
        public ObservableGitHubClient(IGitHubClient gitHubClient)
        {
            Ensure.ArgumentNotNull(gitHubClient, "githubClient");

            _gitHubClient = gitHubClient;
            Authorization = new ObservableAuthorizationsClient(gitHubClient);
            Activity      = new ObservableActivitiesClient(gitHubClient);
            Issue         = new ObservableIssuesClient(gitHubClient);
            Miscellaneous = new ObservableMiscellaneousClient(gitHubClient);
            Oauth         = new ObservableOauthClient(gitHubClient);
            Organization  = new ObservableOrganizationsClient(gitHubClient);
            PullRequest   = new ObservablePullRequestsClient(gitHubClient);
            Repository    = new ObservableRepositoriesClient(gitHubClient);
            User          = new ObservableUsersClient(gitHubClient);
            Git           = new ObservableGitDatabaseClient(gitHubClient);
            Gist          = new ObservableGistsClient(gitHubClient);
            Search        = new ObservableSearchClient(gitHubClient);
            Enterprise    = new ObservableEnterpriseClient(gitHubClient);
            Migration     = new ObservableMigrationClient(gitHubClient);
            Reaction      = new ObservableReactionsClient(gitHubClient);
        }
            public async Task IsALukeWarmObservable()
            {
                var repository = new Repository();
                var response = Task.Factory.StartNew<IResponse<Repository>>(() =>
                    new ApiResponse<Repository> { BodyAsObject = repository });
                var connection = Substitute.For<IConnection>();
                connection.GetAsync<Repository>(Args.Uri, null, null).Returns(response);
                var gitHubClient = new GitHubClient(connection);
                var client = new ObservableRepositoriesClient(gitHubClient);
                var observable = client.Get("stark", "ned");
                connection.Received(0).GetAsync<Repository>(Args.Uri);

                var result = await observable;
                connection.Received(1).GetAsync<Repository>(Args.Uri, null, null);
                var result2 = await observable;
                // TODO: If we change this to a warm observable, we'll need to change this to Received(2)
                connection.Received(1).GetAsync<Repository>(Args.Uri, null, null);

                Assert.Same(repository, result);
                Assert.Same(repository, result2);
            }
        public ObservableGitHubClient(IGitHubClient gitHubClient)
        {
            Ensure.ArgumentNotNull(gitHubClient, "githubClient");

            _gitHubClient = gitHubClient;
            Authorization = new ObservableAuthorizationsClient(gitHubClient);
            Activity = new ObservableActivitiesClient(gitHubClient);
            Issue = new ObservableIssuesClient(gitHubClient);
            Miscellaneous = new ObservableMiscellaneousClient(gitHubClient);
            Oauth = new ObservableOauthClient(gitHubClient);
            Organization = new ObservableOrganizationsClient(gitHubClient);
            PullRequest = new ObservablePullRequestsClient(gitHubClient);
            Repository = new ObservableRepositoriesClient(gitHubClient);
            User = new ObservableUsersClient(gitHubClient);
            Git = new ObservableGitDatabaseClient(gitHubClient);
            Gist = new ObservableGistsClient(gitHubClient);
            Search = new ObservableSearchClient(gitHubClient);
            Enterprise = new ObservableEnterpriseClient(gitHubClient);
            Migration = new ObservableMigrationClient(gitHubClient);
            Reaction = new ObservableReactionsClient(gitHubClient);
        }
            public void CallsIntoClient()
            {
                var github = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(github);

                client.GetBranch("owner", "repo", "branch");

                github.Repository.Received(1).GetBranch("owner", "repo", "branch");
            }
            public async Task EnsuresArguments()
            {
                var github = Substitute.For<IGitHubClient>();
                var nonreactiveClient = new RepositoriesClient(Substitute.For<IApiConnection>());
                github.Repository.Returns(nonreactiveClient);
                var client = new ObservableRepositoriesClient(github);
                var update = new RepositoryUpdate();

                Assert.Throws<ArgumentNullException>(() => client.Edit(null, "repo", update));
                Assert.Throws<ArgumentNullException>(() => client.Edit("owner", null, update));
                Assert.Throws<ArgumentNullException>(() => client.Edit("owner", "repo", null));
                Assert.Throws<ArgumentException>(() => client.Edit("", "repo", update));
                Assert.Throws<ArgumentException>(() => client.Edit("owner", "", update));
            }
            public void EnsuresArguments()
            {
                var client = new ObservableRepositoriesClient(Substitute.For<IGitHubClient>());

                Assert.Throws<ArgumentNullException>(() => client.GetAllTags(null, "repo"));
                Assert.Throws<ArgumentNullException>(() => client.GetAllTags("owner", null));
                Assert.Throws<ArgumentException>(() => client.GetAllTags("", "repo"));
                Assert.Throws<ArgumentException>(() => client.GetAllTags("owner", ""));
            }
            public void GetsCorrectUrl()
            {
                var github = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(github);
                var expected = new Uri("repos/owner/repo/tags", UriKind.Relative);

                client.GetAllTags("owner", "repo");

                github.Connection.Received(1).GetResponse<List<RepositoryTag>>(expected);
            }
            public void RequestsTheCorrectUrlWithRepositoryId()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(gitHubClient);
                var expected = new Uri("repositories/1/tags", UriKind.Relative);

                client.GetAllTags(1);

                gitHubClient.Connection.Received(1).Get<List<RepositoryTag>>(expected, Arg.Any<IDictionary<string, string>>(), null);
            }
            public void GetsCorrectUrl()
            {
                var github = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(github);
                var expected = new Uri("repos/owner/repo/contributors", UriKind.Relative);

                client.GetAllContributors("owner", "repo");

                github.Connection.Received(1)
                    .Get<List<RepositoryContributor>>(expected,
                                          Arg.Any<IDictionary<string, string>>(),
                                          Arg.Any<string>());
            }
            public void CallsCorrectApi()
            {
                var github = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(github);

                client.Commits.Get("owner", "repo", "reference");

                github.Repository.Commits.Received(1).Get("owner", "repo", "reference");
            }
            public void RequestsTheCorrectUrlWithRepositoryIdWithApiOptionsIncludeAnonymous()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(gitHubClient);

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

                client.GetAllContributors(1, true, options);

                gitHubClient.Connection.Received()
                    .Get<List<RepositoryContributor>>(Arg.Is<Uri>(u => u.ToString() == "repositories/1/contributors"), Arg.Is<IDictionary<string, string>>(d => d.Count == 3 && d["anon"] == "1" && d["page"] == "1" && d["per_page"] == "1"), null);
            }
            public async Task EnsuresNonNullArguments()
            {
                var client = new ObservableRepositoriesClient(Substitute.For<IGitHubClient>());
                var update = new BranchUpdate();

                Assert.Throws<ArgumentNullException>(() => client.EditBranch(null, "repo", "branch", update));
                Assert.Throws<ArgumentNullException>(() => client.EditBranch("owner", null, "branch", update));
                Assert.Throws<ArgumentNullException>(() => client.EditBranch("owner", "repo", null, update));
                Assert.Throws<ArgumentNullException>(() => client.EditBranch("owner", "repo", "branch", null));

                Assert.Throws<ArgumentNullException>(() => client.EditBranch(1, null, update));
                Assert.Throws<ArgumentNullException>(() => client.EditBranch(1, "branch", null));

                Assert.Throws<ArgumentException>(() => client.EditBranch("", "repo", "branch", update));
                Assert.Throws<ArgumentException>(() => client.EditBranch("owner", "", "branch", update));
                Assert.Throws<ArgumentException>(() => client.EditBranch("owner", "repo", "", update));

                Assert.Throws<ArgumentException>(() => client.EditBranch(1, "", update));
            }
            public async Task ReturnsEveryPageOfRepositories()
            {
                var firstPageUrl = new Uri("/repositories?since=364", UriKind.Relative);
                var secondPageUrl = new Uri("https://example.com/page/2");
                var firstPageLinks = new Dictionary<string, Uri> { { "next", secondPageUrl } };
                IApiResponse<List<Repository>> firstPageResponse = new ApiResponse<List<Repository>>(
                    CreateResponseWithApiInfo(firstPageLinks),
                    new List<Repository>
                    {
                        new Repository(364),
                        new Repository(365),
                        new Repository(366)
                    });

                var thirdPageUrl = new Uri("https://example.com/page/3");
                var secondPageLinks = new Dictionary<string, Uri> { { "next", thirdPageUrl } };
                IApiResponse<List<Repository>> secondPageResponse = new ApiResponse<List<Repository>>
                (
                    CreateResponseWithApiInfo(secondPageLinks),
                    new List<Repository>
                    {
                        new Repository(367),
                        new Repository(368),
                        new Repository(369)
                    });

                IApiResponse<List<Repository>> lastPageResponse = new ApiResponse<List<Repository>>(
                    new Response(),
                    new List<Repository>
                    {
                        new Repository(370)
                    });

                var gitHubClient = Substitute.For<IGitHubClient>();
                gitHubClient.Connection.Get<List<Repository>>(firstPageUrl, null, null)
                    .Returns(Task.FromResult(firstPageResponse));
                gitHubClient.Connection.Get<List<Repository>>(secondPageUrl, null, null)
                    .Returns(Task.FromResult(secondPageResponse));
                gitHubClient.Connection.Get<List<Repository>>(thirdPageUrl, null, null)
                    .Returns(Task.FromResult(lastPageResponse));

                var repositoriesClient = new ObservableRepositoriesClient(gitHubClient);

                var results = await repositoriesClient.GetAllPublic(new PublicRepositoryRequest(364)).ToArray();

                Assert.Equal(7, results.Length);
                gitHubClient.Connection.Received(1).Get<List<Repository>>(firstPageUrl, null, null);
                gitHubClient.Connection.Received(1).Get<List<Repository>>(secondPageUrl, null, null);
                gitHubClient.Connection.Received(1).Get<List<Repository>>(thirdPageUrl, null, null);
            }
            public void PatchsTheCorrectUrlWithRepositoryId()
            {
                var github = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(github);
                var update = new BranchUpdate();

                client.EditBranch(1, "branch", update);

                github.Repository.Received(1).EditBranch(1, "branch", update);
            }
            public void RequestsTheCorrectUrlWithRepositoryId()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(gitHubClient);
                var expected = new Uri("repositories/1/languages", UriKind.Relative);

                client.GetAllLanguages(1);

                gitHubClient.Connection.Received(1).GetResponse<List<Tuple<string, long>>>(expected);
            }
            public void RequestsTheCorrectUrlWithRepositoryIdWithApiOptions()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(gitHubClient);
                var expected = new Uri("repositories/1/tags", UriKind.Relative);

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

                client.GetAllTags(1, options);

                gitHubClient.Connection.Received(1).Get<List<RepositoryTag>>(expected, Arg.Is<IDictionary<string, string>>(d => d.Count == 2 && d["page"] == "1" && d["per_page"] == "1"), null);
            }
            public void CallsIntoClient()
            {
                var github = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(github);
                var update = new RepositoryUpdate();

                client.Edit("owner", "repo", update);

                github.Repository.Received(1).Edit("owner", "repo", update);
            }
            public void EnsuresNonNullArguments()
            {
                var client = new ObservableRepositoriesClient(Substitute.For<IGitHubClient>());

                Assert.Throws<ArgumentNullException>(() => client.GetAllContributors(null, "repo"));
                Assert.Throws<ArgumentNullException>(() => client.GetAllContributors("owner", null));
                Assert.Throws<ArgumentNullException>(() => client.GetAllContributors(null, "repo", ApiOptions.None));
                Assert.Throws<ArgumentNullException>(() => client.GetAllContributors("owner", null, ApiOptions.None));
                Assert.Throws<ArgumentNullException>(() => client.GetAllContributors("owner", "repo", null));
                Assert.Throws<ArgumentNullException>(() => client.GetAllContributors(null, "repo", false, ApiOptions.None));
                Assert.Throws<ArgumentNullException>(() => client.GetAllContributors("owner", null, false, ApiOptions.None));
                Assert.Throws<ArgumentNullException>(() => client.GetAllContributors("owner", "repo", false, null));

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

                Assert.Throws<ArgumentException>(() => client.GetAllContributors("", "repo"));
                Assert.Throws<ArgumentException>(() => client.GetAllContributors("owner", ""));
                Assert.Throws<ArgumentException>(() => client.GetAllContributors("", "repo", ApiOptions.None));
                Assert.Throws<ArgumentException>(() => client.GetAllContributors("owner", "", ApiOptions.None));
                Assert.Throws<ArgumentException>(() => client.GetAllContributors("", "repo", false, ApiOptions.None));
                Assert.Throws<ArgumentException>(() => client.GetAllContributors("owner", "", false, ApiOptions.None));
            }
            public async Task StopsMakingNewRequestsWhenTakeIsFulfilled()
            {
                var firstPageUrl = new Uri("user/repos", UriKind.Relative);
                var secondPageUrl = new Uri("https://example.com/page/2");
                var firstPageLinks = new Dictionary<string, Uri> { { "next", secondPageUrl } };
                var firstPageResponse = new ApiResponse<List<Repository>>
                {
                    BodyAsObject = new List<Repository>
                    {
                        new Repository {Id = 1},
                        new Repository {Id = 2},
                        new Repository {Id = 3}
                    },
                    ApiInfo = CreateApiInfo(firstPageLinks)
                };
                var thirdPageUrl = new Uri("https://example.com/page/3");
                var secondPageLinks = new Dictionary<string, Uri> { { "next", thirdPageUrl } };
                var secondPageResponse = new ApiResponse<List<Repository>>
                {
                    BodyAsObject = new List<Repository>
                    {
                        new Repository {Id = 4},
                        new Repository {Id = 5},
                        new Repository {Id = 6}
                    },
                    ApiInfo = CreateApiInfo(secondPageLinks)
                };
                var fourthPageUrl = new Uri("https://example.com/page/4");
                var thirdPageLinks = new Dictionary<string, Uri> { { "next", fourthPageUrl } };
                var thirdPageResponse = new ApiResponse<List<Repository>>
                {
                    BodyAsObject = new List<Repository>
                    {
                        new Repository {Id = 7}
                    },
                    ApiInfo = CreateApiInfo(thirdPageLinks)
                };
                var lastPageResponse = new ApiResponse<List<Repository>>
                {
                    BodyAsObject = new List<Repository>
                    {
                        new Repository {Id = 8}
                    },
                    ApiInfo = CreateApiInfo(new Dictionary<string, Uri>())
                };
                var gitHubClient = Substitute.For<IGitHubClient>();
                gitHubClient.Connection.GetResponse<List<Repository>>(firstPageUrl)
                    .Returns(Task.Factory.StartNew<IResponse<List<Repository>>>(() => firstPageResponse));
                gitHubClient.Connection.GetResponse<List<Repository>>(secondPageUrl)
                    .Returns(Task.Factory.StartNew<IResponse<List<Repository>>>(() => secondPageResponse));
                gitHubClient.Connection.GetResponse<List<Repository>>(thirdPageUrl)
                    .Returns(Task.Factory.StartNew<IResponse<List<Repository>>>(() => thirdPageResponse));
                gitHubClient.Connection.GetResponse<List<Repository>>(fourthPageUrl)
                    .Returns(Task.Factory.StartNew<IResponse<List<Repository>>>(() => lastPageResponse));
                var repositoriesClient = new ObservableRepositoriesClient(gitHubClient);

                var results = await repositoriesClient.GetAllForCurrent().Take(4).ToArray();

                Assert.Equal(4, results.Length);
                gitHubClient.Connection.Received(1).Get<List<Repository>>(firstPageUrl, null, null);
                gitHubClient.Connection.Received(1).Get<List<Repository>>(secondPageUrl, null, null);
                gitHubClient.Connection.Received(0).Get<List<Repository>>(thirdPageUrl, null, null);
                gitHubClient.Connection.Received(0).Get<List<Repository>>(fourthPageUrl, null, null);
            }
            public void GetsCorrectUrl()
            {
                var github = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(github);
                var expected = new Uri("repos/owner/repo/commits/reference", UriKind.Relative);

                client.Commits.Get("owner", "repo", "reference");

                github.Repository.Commits.Received(1).Get("owner", "repo", "reference");
            }
            public void RequestsTheCorrectUrlWithRepositoryId()
            {
                var github = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(github);

                client.GetBranch(1, "branch");

                github.Repository.Received(1).GetBranch(1, "branch");
            }
            public void RequestsTheCorrectUrl()
            {
                var gitHubClient = Substitute.For<IGitHubClient>();
                var client = new ObservableRepositoriesClient(gitHubClient);
                var expected = new Uri("repos/owner/repo/teams", UriKind.Relative);

                client.GetAllTeams("owner", "repo");

                gitHubClient.Connection.Received(1).Get<List<Team>>(expected,
                    Arg.Any<IDictionary<string, string>>(),
                    Arg.Any<string>());
            }