本文整理汇总了C#中Octokit.Reactive.ObservablePullRequestsClient类的典型用法代码示例。如果您正苦于以下问题:C# ObservablePullRequestsClient类的具体用法?C# ObservablePullRequestsClient怎么用?C# ObservablePullRequestsClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObservablePullRequestsClient类属于Octokit.Reactive命名空间,在下文中一共展示了ObservablePullRequestsClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ObservableRepositoriesClient
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);
#pragma warning disable CS0618 // Type or member is obsolete
RepoCollaborators = new ObservableRepoCollaboratorsClient(client);
#pragma warning restore CS0618 // Type or member is obsolete
Collaborator = new ObservableRepoCollaboratorsClient(client);
Deployment = new ObservableDeploymentsClient(client);
Statistics = new ObservableStatisticsClient(client);
PullRequest = new ObservablePullRequestsClient(client);
#pragma warning disable CS0618 // Type or member is obsolete
RepositoryComments = new ObservableRepositoryCommentsClient(client);
#pragma warning restore CS0618 // Type or member is obsolete
Comment = new ObservableRepositoryCommentsClient(client);
#pragma warning disable CS0618 // Type or member is obsolete
Commits = new ObservableRepositoryCommitsClient(client);
#pragma warning restore CS0618 // Type or member is obsolete
Commit = new ObservableRepositoryCommitsClient(client);
Release = new ObservableReleasesClient(client);
DeployKeys = new ObservableRepositoryDeployKeysClient(client);
Content = new ObservableRepositoryContentsClient(client);
Merging = new ObservableMergingClient(client);
Page = new ObservableRepositoryPagesClient(client);
}
示例2: GetsFromClientRepositoryPullRequest
public void GetsFromClientRepositoryPullRequest()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservablePullRequestsClient(gitHubClient);
client.Get("fake", "repo", 42);
gitHubClient.Repository.PullRequest.Received().Get("fake", "repo", 42);
}
示例3: EnsuresNonNullArguments
public async Task EnsuresNonNullArguments()
{
var client = new ObservablePullRequestsClient(Substitute.For<IGitHubClient>());
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Get(null, "name", 1).ToTask());
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Get("owner", null, 1).ToTask());
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Get(null, "", 1).ToTask());
await Assert.ThrowsAsync<ArgumentException>(() => client.Get("", null, 1).ToTask());
}
示例4: RequestsCorrectUrlWithRepositoryId
public void RequestsCorrectUrlWithRepositoryId()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservablePullRequestsClient(gitHubClient);
client.GetAllForRepository(1);
gitHubClient.Received().PullRequest.GetAllForRepository(1);
}
示例5: SendsAppropriateParameters
public void SendsAppropriateParameters()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservablePullRequestsClient(gitHubClient);
var pullRequestRequest = new PullRequestRequest { SortDirection = SortDirection.Descending };
client.GetAllForRepository("fake", "repo", pullRequestRequest);
gitHubClient.Received().PullRequest.GetAllForRepository("fake", "repo", pullRequestRequest, Args.ApiOptions);
}
示例6: ObservableRepositoriesClient
public ObservableRepositoriesClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
_client = client.Repository;
_connection = client.Connection;
CommitStatus = new ObservableCommitStatusClient(client);
RepoCollaborators = new ObservableRepoCollaboratorsClient(client);
Deployment = new ObservableDeploymentsClient(client);
Statistics = new ObservableStatisticsClient(client);
PullRequest = new ObservablePullRequestsClient(client);
}
示例7: ReturnsEveryPageOfPullRequests
public void ReturnsEveryPageOfPullRequests()
{
var firstPageUrl = new Uri("repos/fake/repo/pulls", UriKind.Relative);
var secondPageUrl = new Uri("https://example.com/page/2");
var firstPageLinks = new Dictionary<string, Uri> { { "next", secondPageUrl } };
var firstPageResponse = new ApiResponse<List<PullRequest>>
{
BodyAsObject = new List<PullRequest>
{
new PullRequest {Number = 1},
new PullRequest {Number = 2},
new PullRequest {Number = 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<PullRequest>>
{
BodyAsObject = new List<PullRequest>
{
new PullRequest {Number = 4},
new PullRequest {Number = 5},
new PullRequest {Number = 6},
},
ApiInfo = CreateApiInfo(secondPageLinks)
};
var lastPageResponse = new ApiResponse<List<PullRequest>>
{
BodyAsObject = new List<PullRequest>
{
new PullRequest {Number = 7},
},
ApiInfo = CreateApiInfo(new Dictionary<string, Uri>())
};
var gitHubClient = Substitute.For<IGitHubClient>();
gitHubClient.Connection.Get<List<PullRequest>>(firstPageUrl, null, null)
.Returns(Task.Factory.StartNew<IResponse<List<PullRequest>>>(() => firstPageResponse));
gitHubClient.Connection.Get<List<PullRequest>>(secondPageUrl, null, null)
.Returns(Task.Factory.StartNew<IResponse<List<PullRequest>>>(() => secondPageResponse));
gitHubClient.Connection.Get<List<PullRequest>>(thirdPageUrl, null, null)
.Returns(Task.Factory.StartNew<IResponse<List<PullRequest>>>(() => lastPageResponse));
var client = new ObservablePullRequestsClient(gitHubClient);
var results = client.GetForRepository("fake", "repo").ToArray().Wait();
Assert.Equal(7, results.Length);
Assert.Equal(firstPageResponse.BodyAsObject[0].Number, results[0].Number);
Assert.Equal(secondPageResponse.BodyAsObject[1].Number, results[4].Number);
Assert.Equal(lastPageResponse.BodyAsObject[0].Number, results[6].Number);
}
示例8: RequestsCorrectUrlWithApiOptions
public void RequestsCorrectUrlWithApiOptions()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservablePullRequestsClient(gitHubClient);
var options = new ApiOptions
{
PageCount = 1,
PageSize = 1,
StartPage = 1
};
client.GetAllForRepository("fake", "repo", options);
gitHubClient.Received().PullRequest.GetAllForRepository("fake", "repo", options);
}
示例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);
Oauth = new ObservableOauthClient(gitHubClient);
Organization = new ObservableOrganizationsClient(gitHubClient);
PullRequest = new ObservablePullRequestsClient(gitHubClient);
Repository = new ObservableRepositoriesClient(gitHubClient);
SshKey = new ObservableSshKeysClient(gitHubClient);
User = new ObservableUsersClient(gitHubClient);
Git = new ObservableGitDatabaseClient(gitHubClient);
Gist = new ObservableGistsClient(gitHubClient);
Search = new ObservableSearchClient(gitHubClient);
}
示例10: ObservableRepositoriesClient
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);
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);
}
示例11: 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);
}
示例12: PullRequestMerged
public void PullRequestMerged()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservablePullRequestsClient(gitHubClient);
client.Merged("fake", "repo", 42);
gitHubClient.Repository.PullRequest.Received().Merged("fake", "repo", 42);
}
示例13: MergesPullRequest
public void MergesPullRequest()
{
var mergePullRequest = new MergePullRequest { CommitMessage = "fake commit message" };
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservablePullRequestsClient(gitHubClient);
client.Merge("fake", "repo", 42, mergePullRequest);
gitHubClient.Repository.PullRequest.Received().Merge("fake", "repo", 42, mergePullRequest);
}
示例14: EnsuresArgumentsNotNull
public async Task EnsuresArgumentsNotNull()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservablePullRequestsClient(gitHubClient);
await Assert.ThrowsAsync<ArgumentNullException>(() =>
client.Create(null, "name", new NewPullRequest("title", "ref", "ref2")).ToTask());
await Assert.ThrowsAsync<ArgumentException>(() =>
client.Create("", "name", new NewPullRequest("title", "ref", "ref2")).ToTask());
await Assert.ThrowsAsync<ArgumentNullException>(() =>
client.Create("owner", null, new NewPullRequest("title", "ref", "ref2")).ToTask());
await Assert.ThrowsAsync<ArgumentException>(() =>
client.Create("owner", "", new NewPullRequest("title", "ref", "ref2")).ToTask());
await Assert.ThrowsAsync<ArgumentNullException>(() =>
client.Create("owner", "name", null).ToTask());
}
示例15: UpdatesClientRepositoryPullRequest
public void UpdatesClientRepositoryPullRequest()
{
var pullRequestUpdate = new PullRequestUpdate();
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservablePullRequestsClient(gitHubClient);
client.Update("fake", "repo", 42, pullRequestUpdate);
gitHubClient.Repository.PullRequest.Received().Update("fake", "repo", 42, pullRequestUpdate);
}