当前位置: 首页>>代码示例>>C#>>正文


C# Reactive.ObservableRepositoriesClient类代码示例

本文整理汇总了C#中Octokit.Reactive.ObservableRepositoriesClient的典型用法代码示例。如果您正苦于以下问题:C# ObservableRepositoriesClient类的具体用法?C# ObservableRepositoriesClient怎么用?C# ObservableRepositoriesClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ObservableRepositoriesClient类属于Octokit.Reactive命名空间,在下文中一共展示了ObservableRepositoriesClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RequestsCorrectUrlWithRepositoryId

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

                await client.Get(1);

                gitHubClient.Repository.Get(1);
            }
开发者ID:RadicalLove,项目名称:octokit.net,代码行数:9,代码来源:ObservableRepositoriesClientTests.cs

示例2: RequestsCorrectUrl

            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");
            }
开发者ID:RadicalLove,项目名称:octokit.net,代码行数:9,代码来源:ObservableRepositoriesClientTests.cs

示例3: EnsuresNonNullArguments

            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", ""));
            }
开发者ID:RadicalLove,项目名称:octokit.net,代码行数:10,代码来源:ObservableRepositoriesClientTests.cs

示例4: ReturnsAllPublicReposSinceLastSeen

            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);
            }
开发者ID:daveaglick,项目名称:octokit.net,代码行数:12,代码来源:ObservableRepositoriesClientTests.cs

示例5: ObservableGitHubClient

        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);
        }
开发者ID:ninjanye,项目名称:octokit.net,代码行数:14,代码来源:ObservableGitHubClient.cs

示例6: ReturnsSpecifiedRepository

            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);
            }
开发者ID:daveaglick,项目名称:octokit.net,代码行数:16,代码来源:ObservableRepositoriesClientTests.cs

示例7: ReturnsEveryPageOfRepositories

            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);
            }
开发者ID:bestwpw,项目名称:octokit.net,代码行数:46,代码来源:ObservableRepositoriesClientTests.cs

示例8: ReturnsSpecifiedRepository

            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);
            }
开发者ID:harunpehlivan,项目名称:octokit.net,代码行数:18,代码来源:ObservableRepositoriesClientTests.cs

示例9: ObservableGitHubClient

        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);
        }
开发者ID:nsavga,项目名称:octokit.net,代码行数:19,代码来源:ObservableGitHubClient.cs

示例10: ObservableGitHubClient

        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);
        }
开发者ID:daveaglick,项目名称:octokit.net,代码行数:21,代码来源:ObservableGitHubClient.cs

示例11: IsALukeWarmObservable

            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);
            }
开发者ID:Techie123,项目名称:octokit.net,代码行数:21,代码来源:ObservableRepositoriesClientTests.cs

示例12: EnsuresArguments

            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));
            }
开发者ID:Feng2012,项目名称:octokit.net,代码行数:14,代码来源:ObservableRepositoriesClientTests.cs

示例13: CallsIntoClient

            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");
            }
开发者ID:Feng2012,项目名称:octokit.net,代码行数:9,代码来源:ObservableRepositoriesClientTests.cs

示例14: GetsCorrectUrl

            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);
            }
开发者ID:Feng2012,项目名称:octokit.net,代码行数:10,代码来源:ObservableRepositoriesClientTests.cs

示例15: RequestsTheCorrectUrlWithRepositoryId

            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);
            }
开发者ID:RadicalLove,项目名称:octokit.net,代码行数:10,代码来源:ObservableRepositoriesClientTests.cs


注:本文中的Octokit.Reactive.ObservableRepositoriesClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。