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


C# ObservablePullRequestsClient.Commits方法代码示例

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


在下文中一共展示了ObservablePullRequestsClient.Commits方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FetchesAllCommitsForPullRequest

            public async Task FetchesAllCommitsForPullRequest()
            {
                var commit = new PullRequestCommit(null, null, null, null, null, Enumerable.Empty<GitReference>(), null, null);
                var expectedUrl = string.Format("repos/fake/repo/pulls/42/commits");
                var gitHubClient = Substitute.For<IGitHubClient>();
                var connection = Substitute.For<IConnection>();
                IApiResponse<List<PullRequestCommit>> response = new ApiResponse<List<PullRequestCommit>>
                (
                    new Response(),
                    new List<PullRequestCommit> { commit }
                );
                connection.Get<List<PullRequestCommit>>(Args.Uri, null, null)
                    .Returns(Task.FromResult(response));
                gitHubClient.Connection.Returns(connection);
                var client = new ObservablePullRequestsClient(gitHubClient);

                var commits = await client.Commits("fake", "repo", 42).ToList();

                Assert.Equal(1, commits.Count);
                Assert.Same(commit, commits[0]);
                connection.Received().Get<List<PullRequestCommit>>(new Uri(expectedUrl, UriKind.Relative), null, null);
            }
开发者ID:cloudRoutine,项目名称:octokit.net,代码行数:22,代码来源:ObservablePullRequestsClientTests.cs

示例2: EnsuresNonNullArguments

            public async Task EnsuresNonNullArguments()
            {
                var connection = Substitute.For<IGitHubClient>();
                var client = new ObservablePullRequestsClient(connection);

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

                Assert.Throws<ArgumentException>(() => client.Commits("", "name", 1));
                Assert.Throws<ArgumentException>(() => client.Commits("owner", "", 1));
            }
开发者ID:daveaglick,项目名称:octokit.net,代码行数:11,代码来源:ObservablePullRequestsClientTests.cs

示例3: FetchesAllCommitsForPullRequest

            public async Task FetchesAllCommitsForPullRequest()
            {
                var commit = new PullRequestCommit();
                var expectedUrl = string.Format("repos/fake/repo/pulls/42/commits");
                var gitHubClient = Substitute.For<IGitHubClient>();
                var connection = Substitute.For<IConnection>();
                IResponse<List<PullRequestCommit>> response = new ApiResponse<List<PullRequestCommit>>
                {
                    ApiInfo = new ApiInfo(
                        new Dictionary<string, Uri>(),
                        new List<string>(),
                        new List<string>(),
                        "",
                        new RateLimit(new Dictionary<string, string>())),
                    BodyAsObject = new List<PullRequestCommit> { commit }
                };
                connection.Get<List<PullRequestCommit>>(Args.Uri, null, null)
                    .Returns(Task.FromResult(response));
                gitHubClient.Connection.Returns(connection);
                var client = new ObservablePullRequestsClient(gitHubClient);

                var commits = await client.Commits("fake", "repo", 42).ToList();

                Assert.Equal(1, commits.Count);
                Assert.Same(commit, commits[0]);
                connection.Received().Get<List<PullRequestCommit>>(new Uri(expectedUrl, UriKind.Relative), null, null);
            }
开发者ID:Feng2012,项目名称:octokit.net,代码行数:27,代码来源:ObservablePullRequestsClientTests.cs

示例4: FetchesAllCommitsForPullRequest

            public async void FetchesAllCommitsForPullRequest()
            {
                var expectedUrl = string.Format("repos/fake/repo/pulls/42/commits");
                var gitHubClient = Substitute.For<IGitHubClient>();
                var connection = Substitute.For<IConnection>();
                gitHubClient.Connection.Returns(connection);
                var client = new ObservablePullRequestsClient(gitHubClient);

                client.Commits("fake", "repo", 42);

                connection.Received().Get<List<PullRequestCommit>>(new Uri(expectedUrl, UriKind.Relative), null, null);
            }
开发者ID:KimCM,项目名称:octokit.net,代码行数:12,代码来源:ObservablePullRequestsClientTests.cs


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