本文整理汇总了C#中Octokit.Reactive.ObservableRepositoriesClient.Get方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableRepositoriesClient.Get方法的具体用法?C# ObservableRepositoriesClient.Get怎么用?C# ObservableRepositoriesClient.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Octokit.Reactive.ObservableRepositoriesClient
的用法示例。
在下文中一共展示了ObservableRepositoriesClient.Get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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");
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}
示例6: EnsuresNonNullArguments
public async Task EnsuresNonNullArguments()
{
var client = new ObservableRepositoriesClient(Substitute.For<IGitHubClient>());
Assert.Throws<ArgumentNullException>(() => client.Get(null, "name"));
Assert.Throws<ArgumentNullException>(() => client.Get("owner", null));
Assert.Throws<ArgumentException>(() => client.Get("", "name"));
Assert.Throws<ArgumentException>(() => client.Get("owner", ""));
}
示例7: IsALukeWarmObservable
public async Task IsALukeWarmObservable()
{
var repository = new Repository();
var response = Task.Factory.StartNew<IApiResponse<Repository>>(() =>
new ApiResponse<Repository>(new Response(), repository));
var connection = Substitute.For<IConnection>();
connection.Get<Repository>(Args.Uri, null, "application/vnd.github.polaris-preview+json").Returns(response);
var gitHubClient = new GitHubClient(connection);
var client = new ObservableRepositoriesClient(gitHubClient);
var observable = client.Get("stark", "ned");
connection.Received(1).Get<Repository>(Args.Uri, null, "application/vnd.github.polaris-preview+json");
var result = await observable;
connection.Received(1).Get<Repository>(Args.Uri, null, "application/vnd.github.polaris-preview+json");
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).Get<Repository>(Args.Uri, null, "application/vnd.github.polaris-preview+json");
Assert.Same(repository, result);
Assert.Same(repository, result2);
}