本文整理汇总了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);
}
示例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));
}
示例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);
}
示例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);
}